Database Upgrade

by
Odoo
v 6.1 v 7.0 v 8.0 v 9.0 v 10.0 v 11.0 v 12.0 Third Party 386
Download for v 11.0 Deploy on Odoo.sh
Lines of code 382
Technical Name smile_upgrade
LicenseAGPL-3
Websitehttp://www.smile.fr
Also available in version v 8.0 v 9.0 v 10.0 v 7.0 v 12.0 v 13.0 v 6.1
You bought this module and need support? Click here!

Database Upgrade

License: AGPL-3 Smile-SA/odoo_addons

This module helps you upgrade database automatically after code update and server restarting.

Table of contents

Requirements

There are no requirements to use this module.

Usage

Configuration

Upgrade tree view

Upgrades directory must be structured like this:

project
├── upgrades
|   ├── 1.1
|   |   ├── __upgrade__.py
|   |   ├── *.sql
|   |   ├── *.yml  # only for post-load
|   |   ├── *.csv  # only for post-load
|   |   ├── *.xml  # only for post-load
|   ├── 1.2
|   |   ├── __upgrade__.py
|   |   ├── *.sql
|   ├── upgrade.conf

You can find an example of upgrade in demo directory of this module.

Configure the version

Fill the file __upgrade__.py with following options:

  • version
  • databases: let empty if valid for all databases
  • translations_to_reload: language codes list to reload in post-load
  • description
  • modules_to_install_at_creation: modules list to install at database creation
  • modules_to_upgrade: modules list to update or to install
  • pre-load: list of .sql files
  • post-load: list with .sql, .yml, .csv and .xml files
    • .../filename (depending on option upgrades_path) or
    • module_name/.../filename

Configure the version to load

The upgrade version to load is set in file upgrade.conf, at the root of the upgrades directory, with this content (replace the version by your version number):

[options]
version=1.2

Execute an upgrade

Odoo configuration

Update your Odoo configuration file with the following options:

  • upgrades_path (required): path to the upgrades directory
  • stop_after_upgrades (default: False): stop server after upgrades if True

Execute upgrade

To execute an upgrade, you need to launch server with the following command:

odoo.py -c <config_file> -d <db_name> --load=web,smile_upgrade

Additional features

Specify error management

In post-load, you can replace filename string by tuple to specify error management.

Available options are:

  • raise (default value): if an error is raised, stop upgrade execution by raising the error
  • rollback_and_continue: if an error is raised, rollback to the savepoint set before the file execution and continue with the other files of the list
  • not_rollback_and_continue: if an error is raised, no rollback is done and continue with the other files of the list

Example:

'post-load': [
    ('post-load/fix_product_pricelist.yml', 'rollback_and_continue'),
],

Log fields.function on errors

In .yml files, add context['store_in_secure_mode'] = True if you want to compute fields.function (storeset_values) by catching errors and logging them {record_id: error}

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback here.

Do not contact contributors directly about support or help with technical issues.

Credits

Contributors

  • Corentin POUHET-BRUNERIE

Maintainer

This module is maintained by Smile SA.

Since 1991 Smile has been a pioneer of technology and also the European expert in open source solutions.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.