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

All production users local data gets lost on DataStore migration #3746

Open
amruth-movano opened this issue Jun 12, 2024 · 6 comments
Open
Labels
datastore Issues related to the DataStore category feature-request Request a new feature question General question

Comments

@amruth-movano
Copy link

Describe the bug

Hi Team,
almost all production users data got lost when updated AmplifyModels.
Before updating the app, users were having all the data, once they updated the app, their old local data got lost.
Its heartbreaking.....🥲🥲🥲 as our app is health app and all the health data is lost now.

Steps To Reproduce

-

Expected behavior

Datastore should not clear the local data

Amplify Framework Version

2.33.6

Amplify Categories

DataStore

Dependency manager

Swift PM

Swift version

5.9.2

CLI version

12.11.1

Xcode version

15.0

Relevant log output

-

Is this a regression?

Yes

Regression additional context

No response

Platforms

iOS

OS Version

iOS 17.0

Device

iPhone15

Specific to simulators

No response

Additional context

No response

@amruth-movano
Copy link
Author

amruth-movano commented Jun 12, 2024

@lawmicha @5d Can you see this please on high priority?

@amruth-movano
Copy link
Author

Only one table model, schema got updated but datastore erased all local data including other table local data also. @lawmicha @5d

@thisisabhash
Copy link
Member

Thank you for posting the issue.

Local migrations (i.e. migrations controlled by the developer) on device are not currently supported. Therefore, your local data will be lost when the schema changes.
If you are syncing with the cloud the structure and items of that data in your AppSync backend will not be touched as part of this process.
https://docs.amplify.aws/gen1/swift/build-a-backend/more-features/datastore/schema-updates/#local-migrations

@thisisabhash thisisabhash added datastore Issues related to the DataStore category question General question feature-request Request a new feature labels Jun 12, 2024
Copy link
Contributor

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@amruth-movano
Copy link
Author

@thisisabhash
We have modified one table schema only. But data store cleared all other tables also. Can you please explain why this is happening?

@thisisabhash
Copy link
Member

The reason for clearing the entire local database is because we don't know the details of the schema changes, if it was an additive or destructive change. So, Amplify assumes it can no longer operate on the same tables.

The local database contains the tables from before the schema changes and also, some internal tables to perform Datastore's sync engine related tasks. This is a feature request - to perform more granular operations during schema upgrades which will facilitate local migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore category feature-request Request a new feature question General question
Projects
None yet
Development

No branches or pull requests

2 participants