Tim Peters wrote:

[Tim Peters]
Stephan Richter was wrestling with a migration script a couple months
ago. I don't know whether he packaged the code he ended up with for
reuse. Here's a record of the IRC chat in which details got worked out:

  http://zope3.pov.lt/irclogs/%23zope3-dev.2005-08-25.log.html

[Stephan Richter]
The resulting code from the discussion is publically available in the
SchoolTool source:


<http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/genera
tions/evolve5.py?rev=4984&view=auto>

[Syver Enstad]
Thank you Stefan. I am right if I suppose that the reason this fixes all
references is that it saves all persistent objects in the database?

Basically, but read the IRC log for details:  it (re)saves the current
revision of all objects not in a version.  It does not change non-current
revisions of objects, nor any revisions of objects in a version.  This is
because the FileStorage iterator only knows about current non-version
revisions.

I don't use versions so that's fine. The IRC log was very illuminating BTW. It seemed to basically be going through exactly the same issues that I have been going through.

Will this also fix references to persistent objects in non persistent
objects stored in the database?

If (and only if) they're reachable from the root object following a chain of
non-version current revisions.  You can't store a non-persistent object N
directly in ZODB -- the only way N can get in is by being attached to a
persistent object P.  Then N's entire state is included in the pickle for P.
So when P is (re)saved, the entire state of N is recomputed, including (of
course) all references to persistent objects (if any) contained in N.


I see, that sounds good to me.

For now I am basically one happy guy. Thanks to everyone for responding and helping me out with my problem migrating.


_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to