magicalpanda/MagicalRecord

Data lost when doing light weight auto migration

expkzb opened this issue · 2 comments

I've added a new xcdatamodel version and added two new entities there.

I use [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:@"KSDrawCoreDataModel"]; to setup.

I change the current model version to the new one. Then launch the app.

Got errors, And all datas are lost.

[error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/DAFF78E5-A778-4ED6-AA33-4C147AA02DA7/Library/Application%20Support/KloudSync/KSDrawCoreDataModel options:(null) ... returned error NSCocoaErrorDomain(134100) with userInfo dictionary {
    metadata =     {
        NSPersistenceFrameworkVersion = 977;
        NSStoreModelVersionHashes =         {
            DrawModel = {length = 32, bytes = 0x42b5f2a6 13ee5e9f 4fcbeb9c 4463774b ... 6ddc0aca 956c5275 };
        };
        NSStoreModelVersionHashesDigest = "t53uX5yj/5RyHlMhfLUQKkgn6W/PE1BrxMot2vEId/ims+Ui/xHyiP95gB5+phSBACulxBnKwLddUayxaIzQHw==";
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
            ""
        );
        NSStoreType = SQLite;
        NSStoreUUID = "707DEE68-04AA-4789-8618-D1C0434E7701";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}
CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/DAFF78E5-A778-4ED6-AA33-4C147AA02DA7/Library/Application%20Support/KloudSync/KSDrawCoreDataModel options:(null) ... returned error NSCocoaErrorDomain(134100) with userInfo dictionary {
    metadata =     {
        NSPersistenceFrameworkVersion = 977;
        NSStoreModelVersionHashes =         {
            DrawModel = {length = 32, bytes = 0x42b5f2a6 13ee5e9f 4fcbeb9c 4463774b ... 6ddc0aca 956c5275 };
        };
        NSStoreModelVersionHashesDigest = "t53uX5yj/5RyHlMhfLUQKkgn6W/PE1BrxMot2vEId/ims+Ui/xHyiP95gB5+phSBACulxBnKwLddUayxaIzQHw==";
        NSStoreModelVersionHashesVersion = 3;
        NSStoreModelVersionIdentifiers =         (
            ""
        );
        NSStoreType = SQLite;
        NSStoreUUID = "707DEE68-04AA-4789-8618-D1C0434E7701";
        "_NSAutoVacuumLevel" = 2;
    };
    reason = "The model used to open the store is incompatible with the one used to create the store";
}

I fixed it in #1378

Coeur commented

Fixed by expkzb. Thank you.
But it will be only on master branch, as there won't be any new release, as the project has stopped.