• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [CodeData] Generic model migration code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [CodeData] Generic model migration code?


  • Subject: Re: [CodeData] Generic model migration code?
  • From: Jakob Olesen <email@hidden>
  • Date: Fri, 8 Sep 2006 13:52:11 +0200


On 08/09/2006, at 11.28, Kaspar Fischer wrote:

- Does anybody have a generic piece of code that takes ANY pair
  of old model and new model with the assumption that the latter
  extends the former, and converts a data store in the old
  model to one from the new model?

I don't have any code for you, sorry. I have thought about the problem, though, and I think it is difficult (not impossible) to write *generic* code. If the data is too big to fit in memory, you have to do intermediate saves without breaking validation. Tricky. User-defined setters and validators could also cause problems.


I used a different solution in my project. I have created a binary attribute in the entities that I think will need to be extended in the future. Then I store a binary plist with a dictionary in that attribute. This also allows me to store more structured data like arrays and dictionaries, but you cannot use those attributes in predicates for fetching.

Right now I am not using transient attributes for the plist entries, but I think maybe I should.

It has worked so far, but some day I have to face the migration problem.

- In this particular situation (adding and not changing attributes)
  it seems (see bottom of 2)) that the problem can be solved by
  saving as XML and then reopening as a store of the new model.
  Is this safe to do in the production environment?

ISTR somebody complaining that XML-like strings are sometimes not properly quoted, but maybe I am thinking about the XML plist format?



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: [CodeData] Generic model migration code?
      • From: Kaspar Fischer <email@hidden>
References: 
 >[CodeData] Generic model migration code? (From: Kaspar Fischer <email@hidden>)

  • Prev by Date: Adding background color to NSmenuItem
  • Next by Date: Re: Adding background color to NSmenuItem
  • Previous by thread: [CodeData] Generic model migration code?
  • Next by thread: Re: [CodeData] Generic model migration code?
  • Index(es):
    • Date
    • Thread