Basic data migration - table already exists

I have an existing iPad app to which I just added key data version control. I went through the documentation and followed the steps described. Now, choosing my new model as the current model with the version and trying to run it on my dev device from xCode, I get the following error:

2012-03-28 07: 35: 42.137 DocsOnTap [2603: 707] CoreData: error: (1) I / O error for the database in / var / mobile / Applications / 06EECF01-3598-4513-8A3A-BE4FD49EEBF6 / Documents / .DocsOnTap.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3. SQLite error code: 1, "table Z_2TAG already exists"

The only change I made to my model was to add one new object. I have a table called Tag in my model - this apparently refers to this error.

If I revert my current model with the version back to the previous version of the model, I can run my application on my device with Xcode without errors.

I read that there might be problems trying to use kernel data transfer on dev devices. However, I just want to check the process to make sure that when updating our application in the Appstore, migration works as expected for our customers.

+4
source share
2 answers

Well, that was an obscure mistake. The object I added was named AppKeys - this should be the name of the object used internally by master data or SQL Lite. I went back to scratches and found that I could add and transfer other attributes and objects without any problems. However, if I tried again to add my entity with the name AppKeys, then I got the same error that "the table Z_2TAG already exists." Therefore, the solution to my problem is to choose a different entity name. It is a pity that this is not documented somewhere obvious - or that the error was not more useful. In any case, I hope this can help someone else one day.

+4
source

In my case, the same error occurred due to the Rename identifier that was set in the data model inspector for Entity . After I deleted the Renaming ID , the problem did not disappear.

+8
source

Source: https://habr.com/ru/post/1403748/


All Articles