Re: Core Data versioning woes

2008-08-10 Thread Quincey Morris
On Aug 10, 2008, at 22:08, Graham Perks wrote: Well that was too easy. I even started off on the right track yesterday before getting derailed. This'll work: - (id)initWithContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { // Migrate? Optional,

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
Well that was too easy. I even started off on the right track yesterday before getting derailed. This'll work: - (id)initWithContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { // Migrate? Optional, but it'd be good to check here if this upgrade

Re: Core Data versioning woes

2008-08-10 Thread Quincey Morris
On Aug 10, 2008, at 19:28, Graham Perks wrote: On Aug 10, 2008, at 2:06 PM, Graham Perks wrote: The document that's open post-migration is the "foo~" version Is this a "feature" of migration? I tried the most basic migration app I could build. And when I try to save, it says "This document

Re: Core Data versioning woes

2008-08-10 Thread Steve Steinitz
Hello Mr Crawford, Oops, didn't want to hijack Graham's nice clean thread. However... On 10/8/08, mmalc crawford wrote: ps. one special problem I have is that I don't want the migration to happen automatically because four users share the same database.

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
On Aug 10, 2008, at 2:06 PM, Graham Perks wrote: The document that's open post-migration is the "foo~" version Is this a "feature" of migration? I tried the most basic migration app I could build. And when I try to save, it says "This document has been renamed to "test2~". While that's diff

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
On Aug 10, 2008, at 8:12 PM, Steve Steinitz wrote: Perhaps you feel like you are talking to yourself but I assure you myself and others are watching your progress. Thanks, Steve. For posterity's sake, if, I should say WHEN, this error pops up: Can't merge models with two different entities

Re: Core Data versioning woes

2008-08-10 Thread mmalc crawford
On Aug 10, 2008, at 6:12 PM, Steve Steinitz wrote: ps. one special problem I have is that I don't want the migration to happen automatically because four users share the same database.

Re: Core Data versioning woes

2008-08-10 Thread Steve Steinitz
Hi Graham, On 10/8/08, Graham Perks wrote: >>Now when I save my document I get a sheet saying, "This >>document's file has been changed by another application since >>you opened or saved it", and asking if I want to save or not. >>Eh? What's that all about? > >The document that's open post-

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
Now when I save my document I get a sheet saying, "This document's file has been changed by another application since you opened or saved it", and asking if I want to save or not. Eh? What's that all about? The document that's open post-migration is the "foo~" version - the backup of the

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
So after some too-late coding and placing my NSLogs in the wrong place, I now find the normal Multiple Validation Errors. After dumping the extra messages in NSDetailedErrorsKey I see the offenders are items that are marked as transient but non-optional. They're set in my entity's awakeFro

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
Astonishing: The migration happens for sure: I end up with a "foo.new" file adjacent to my original file. If I delete the original and open the .new file, it is the migrated version complete will all data, including the new attribute (with its default value) that I added in the new data mod

Re: Core Data versioning woes

2008-08-10 Thread Graham Perks
I've got a little further. I made both model versions identical. Then reset the file back to the old version. Doc opened OK. Add one attribute to the file, reset the file, and I now get: Error Domain=NSCocoaErrorDomain Code=256 "The file could not be opened." from initWithContentsOfUrl:...

Core Data versioning woes

2008-08-10 Thread Graham Perks
Wow, versioning looks SO much better in 10.5. I had my own code for 10.4, I am glad to delete it. I got a quick demo versioning app going, thanks to some excellent advice at http://www.timisted.net/blog/archive/core-data-migration/. The docs should really include that NSDocument override f