I have an app which is using Core Data on Sqlite, Now I have a update which has some DB structure changes say adding a new table
I know when an app get updated, it updates the app binary only, nothing on document directory will be changed.
When the app gets updated and launchs at the first time and run
[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
It will find the difference between the data model and DB structure in Sqlite and will throw an exception and quit.
Error: "The model used to open the store is incompatible with the one used to create the store"
So, can anyone here give me some idea how to update an app when there is a DB structure change?
I think we can run a DB script to create that new table when it launchs the update at the first time.
But if there are other changes like changing the type of some fields or deleting some fields, and we need to migrate the old data, this is really a headache. In this case, Is the only way to do is creating a new app?
Is there anyone tried something similar like this?