I have hundreds of thousands of objects based on plone archetypes (plone 2.5.X) that need their archetypes schema updated to the latest. The archetype schema migration tool is great for a small/medium number objects but is bringing my server to its knees trying to migrate them all, to the point where I always end up killign the script. I would like to be able to update the schema of one object at a time, potentially as the object as retrieved - is that possible? If not, any other approaches to updating archetype schemas in large plone sites?
Thanks in advance!
after digging through the 2.5 catalog code, I've finally found the answer to a lazy schema update:
if not self._isSchemaCurrent():
logging.debug("updating schema for %s"%self.absolute_url())
try:
import transaction
transaction.begin()
self._updateSchema()
transaction.commit()
except Exception, e:
logging.error('Error updating schema at %s: %s'%(self.absolute_url(), e))
return False
else:
logging.debug("schema for %s is up to date"%self.absolute_url())
return True
Note that this is Plone 2.5.3 and from what I was digging through plone 3 looks slightly different. For some objects where I have already customized processForm, I perform the upgrade there so that the form can display the new field and it will get processed. For others just in the at_post_edit_script hook since those usually don't have mega important schema upgrades. Additionally form processing is the slowest part of the site anyways so the user experience isn't affected so much.
Its hacky but it causes no I/O splurges and it works with all versions of objects. I'll take it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With