You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining database versions across different Dexie instances, tables from earlier versions that are not included in later versions are being unexpectedly dropped. This behavior contradicts the documentation which states that tables are not deleted unless explicitly set to null in the new version's store specification.
Tables from version 1 are dropped in version 2 when versions are defined in separate Dexie instances, even though they are not specified as null.
Possible Cause
This issue might be due to the deleteRemovedTables function in schema-helpers.ts, which currently checks for newSchema[storeName] == null. This condition incorrectly flags undefined values, leading to the deletion of tables not explicitly mentioned in the new version.
Suggested Fix
Modify the deleteRemovedTables function to check for newSchema[storeName] === null instead, ensuring only tables set to null are deleted.
Description
When defining database versions across different Dexie instances, tables from earlier versions that are not included in later versions are being unexpectedly dropped. This behavior contradicts the documentation which states that tables are not deleted unless explicitly set to null in the new version's store specification.
Expected Behavior
Per the Dexie documentation on database versioning, tables from previous versions should persist in subsequent versions unless explicitly set to null.
Current Behavior
Tables from version 1 are dropped in version 2 when versions are defined in separate Dexie instances, even though they are not specified as null.
Possible Cause
This issue might be due to the deleteRemovedTables function in schema-helpers.ts, which currently checks for
newSchema[storeName] == null
. This condition incorrectly flags undefined values, leading to the deletion of tables not explicitly mentioned in the new version.Suggested Fix
Modify the deleteRemovedTables function to check for
newSchema[storeName] === null
instead, ensuring only tables set to null are deleted.Reproduction
https://jsfiddle.net/rwe63hmg/
Environment
Dexie version: 3.2.4
Browser: Arc 1.17.2 (43249), Chromium Engine 119.0.6045.159
OS: macOS Ventura 13.0.1
The text was updated successfully, but these errors were encountered: