Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected Table Deletion When Versioning Across Different Dexie Instances #1835

Open
Toeler opened this issue Nov 30, 2023 · 0 comments
Open

Comments

@Toeler
Copy link

Toeler commented Nov 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant