Re: Core Data Migration Exception
Re: Core Data Migration Exception
- Subject: Re: Core Data Migration Exception
- From: Steve Steinitz <email@hidden>
- Date: Wed, 9 Jan 2008 00:14:46 +1100
Hello,
Thanks to Barry Wark for your comments about Core Data' default
migration's use of version information int the store's metadata. I had
a look for the conversation you mentioned between mmalc and Pierre
Bernard but only found a reference to metadata in a thread about
spotlight. Anyway, I think I have a thread somewhere about the topic at
hand so not to worry (can I use that quaint Australian phrase on a US
list?).
That aside, I decided to do a much simpler experiment. 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
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