Re: Core Data Migration Exception
Re: Core Data Migration Exception
- Subject: Re: Core Data Migration Exception
- From: Steve Steinitz <email@hidden>
- Date: Thu, 10 Jan 2008 19:23:52 +1100
Hello,
Can anyone spot any obvious errors I'm making in the following
experiment? I'm not interested in versioning at this point, I just want
to actually see the migration happen successfully.
I created a new Leopard Xcode 3 project to test the default automatic
migration -- just to be sure I had my head around it. It didn't go well.
Here's what I did:
1. created a new Core Data Application Project, MigrationTest
2. added an entity, TestEntity, with one attribute to the MigrationTest
model
3. built and ran MigrationTest
4. confirmed (using SQL Browser Lite) that the database had been created
as expected. Noted that the Z_METADATA table had no records.
5. using the Design menu, added a duplicate model, called
MigrationTest-2 to the MigrationTest project (I get the same
results if I use a versioned model: a .xcdatamodeld packagte
containing two .xcdatamodel models)
6. added an new attribute to TestEntity (to have a change to migrate)
The next two steps, 7 and 8, are related to step 9
7. changed the original model's name to MigrationTest-orig
8. renamed the new model, MigrationTest-2, to, simply, MigrationTest
9. modified the -managedObjectModel method to avoid the error
'Can't merge models with two different entities named ...'
by calling NSManagedModel's -initWithContentsOfUrl to specifically
load the 'MigrationTest' Model rather than calling one of its more
convenient sisters: the four model-merging class methods.
10. used the Design menu to create a Mapping Model.
11. cleaned, built and ran MigrationTest
Result:
rather than migrating the model, it displayed five cascading alerts all
saying:
The file “MigrationTest.sql” could not be opened
because it is not in the right format.
The file might be corrupted, truncated, or in a
different format than you expect.
Is it bug report time or am I missing a point somewhere?
Thanks,
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden