Skip to content

HOW TO Upgrade a Plomino database from a GenericSetup upgrade step

Eric BREHAULT edited this page Sep 21, 2016 · 1 revision

If you export your DB design to a local folder of your site specific skin product, you can update the corresponding database from portal_setup easily.

Let's assume your DB design is exported in your skin product in a folder named ./db.

ZCML:

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="plone">

  <genericsetup:upgradeStep
      title="Upgrade step to refresh Plomino db design"
      description="Upgrade step to refresh Plomino db design"
      source="*"
      destination="*"
      handler=".upgrades.update_db_design"
      profile="my.skin:default" />

</configure>

upgrades.py:

def update_db_design(context):
    db = context.my_folder.mydb
    db.importDesignFromXML(from_folder='./src/my.skin/my/skin/db/mydb')

Now, if you go to ZMI / portal_setup / Upgrades, and you pick your skin products in the list, you will get a step to refresh your db design.