Hibou Roost - Odoo: Odoo Database Management: Common Migration Scenarios

Purpose

Migrations happen. This document outlines the different ways that Hibou Flow can help you through the process.

Resources

Pre/Post Major Upgrade SQL

While our Odoo Enterprise focused migration path has a post-migration script capability that it carries out on the newly restored database, there are many other times you may want to just run a SQL files.

Consider if it is possible to version-control these files in the docker container somehow. If it is not possible to version control this script, make it a file via configmap in Kubernetes, or some other mechanism (e.g. file upload). 

Is your Odoo Dockerized?

Have a look at Hibou Odoo Suite

The below code assumes you have a config file, or environment variables setup capable of communicating with Postgres. It would be possible to restore an arbitrary file into the selected database (like a restore, or a point-in-time adjustment entry).

/entrypoint.sh flow odoo-sql --file /opt/odoo/mig/13.0.sql

Archived Views?

Often, after the Odoo Enterprise upgrade, you'll find that the process also archived your views - even after base upgrade. Now what?

Reactivate or De-activate Module Data with a Declarative Command.

The code below shows two examples. One has a list of modules you want to ensure the views are active, and you'll want to do it now! The other is to re-activate up to a specific version.  By default only the 'installed' flag is checked to activate the views. 

/entrypoint.sh flow odoo-active \
  --modules some_module,some_module_other
# will reject lower than this version 14.0
# it will also allow something like 14.1.0.2
/entrypoint.sh flow odoo-active \
  --modules some_module,some_module_other \
  --version 14.0
# bonus, you can override the model(s), 
# if you had some reason to do so... 
# and why not de-activate the record instead...
/entrypoint.sh flow odoo-active \
  --behavior deactivate \
  --modules bad_module \
  --models res.partner,account.tax