1- =================
2- Migration scripts
3- =================
1+ ===============
2+ Upgrade scripts
3+ ===============
44
5- A migration script is a Python file containing a function called :file: `migrate `, which the upgrade
5+ An upgrade script is a Python file containing a function called :file: `migrate `, which the upgrade
66process invokes during the update of a module.
77
88The :file: `migrate ` function receives two parameters:
@@ -13,14 +13,14 @@ The :file:`migrate` function receives two parameters:
1313Typically, this function executes one or multiple SQL queries and can also access Odoo's ORM, as
1414well as the :doc: `../upgrade/upgrade_util `.
1515
16- As described in :ref: `upgrade_custom/upgraded_database/migrate_data `, you might have to use
17- migration scripts to reflect changes from the source code to their corresponding data.
16+ As described in :ref: `upgrade_custom/upgraded_database/migrate_data `, you might have to use upgrade
17+ scripts to reflect changes from the source code to their corresponding data.
1818
1919
20- Writing migration scripts
20+ Writing upgrade scripts
2121=========================
2222
23- To write what we refer as a **custom migration script **, the path of the file should follow this
23+ To write what we refer as a **custom upgrade script **, the path of the file should follow this
2424template: :file: `<module_name>/migrations/<major_version>.<minor_version>/{ pre|post|end } -*.py `.
2525
2626Follow this steps to create the directory's structure and the Python file:
@@ -34,13 +34,13 @@ Follow this steps to create the directory's structure and the Python file:
3434 - :file: `<minor_version> ` corresponds to the updated version declared on the module's
3535 manifest.
3636
37- Migration scripts are only executed when the module is being updated. Therefore, the
37+ Upgrade scripts are only executed when the module is being updated. Therefore, the
3838 :file: `minor_version ` set in the directory needs to be higher than the module's installed
3939 version and equal or lower to the updated version of the module.
4040 For example, in an `Odoo 16 ` database, with a custom module installed in version `1.1 `, and an
4141 updated module version equal to `1.2 `; the version directory should be `16.0.1.2 `.
4242 #. Create a :file: `Python file ` inside the :file: `<version> ` directory named according to the
43- :ref: `Phase <upgrade/migration -scripts/phases >` on which it needs to be executed. It should
43+ :ref: `Phase <upgrade/upgrade -scripts/phases >` on which it needs to be executed. It should
4444 follow the template `{pre|post|end}-*.py `. The file name will determine the order in which it
4545 is executed for that module, version and phase.
4646 #. Create a :file: `migrate ` function in the Python file that receives as parameters
@@ -49,7 +49,7 @@ Follow this steps to create the directory's structure and the Python file:
4949
5050.. example ::
5151
52- Directory structure of a migration script for a custom module named `awesome_partner ` upgraded
52+ Directory structure of an upgrade script for a custom module named `awesome_partner ` upgraded
5353 to version `2.0.0 ` on Odoo 17
5454
5555 .. code-block :: text
@@ -59,7 +59,7 @@ Follow this steps to create the directory's structure and the Python file:
5959 | |-- 17.0.2.0.0/
6060 | | |-- pre-exclamation.py
6161
62- Two migration scripts examples with the content of the :file: `pre-exclamation.py `, file adding
62+ Two upgrade scripts examples with the content of the :file: `pre-exclamation.py `, file adding
6363 "!" at the end of partners' names:
6464
6565 .. code-block :: python
@@ -94,15 +94,15 @@ Follow this steps to create the directory's structure and the Python file:
9494 to access the ORM. Check the documentation to find out more about this library.
9595
9696
97- Running and testing migration scripts
97+ Running and testing upgrade scripts
9898=====================================
9999
100100.. tabs ::
101101
102102 .. group-tab :: Odoo Online
103103
104104 As the instalation of custom modules containing Python files is not allowed on Odoo Online
105- databases, it is not possible to run migration scripts on this platform.
105+ databases, it is not possible to run upgrade scripts on this platform.
106106
107107 .. group-tab :: Odoo.sh
108108
@@ -111,9 +111,9 @@ Running and testing migration scripts
111111
112112 Once the upgrade of a staging branch is on "Update on commit" mode, each time a commit is
113113 pushed on the branch, the upgraded backup is restored and all the custom modules are updated.
114- This update includes the execution of the migration scripts.
114+ This update includes the execution of the upgrade scripts.
115115
116- When upgrading the production database, the execution of the migration scripts is also part of
116+ When upgrading the production database, the execution of the upgrade scripts is also part of
117117 the update of the custom modules done by the platform when the upgraded database is restored.
118118
119119 .. group-tab :: On-premise
@@ -129,9 +129,9 @@ Running and testing migration scripts
129129 to call the CLI depends on how you installed Odoo.
130130
131131
132- .. _upgrade/migration -scripts/phases :
132+ .. _upgrade/upgrade -scripts/phases :
133133
134- Phases of migration scripts
134+ Phases of upgrade scripts
135135===========================
136136
137137The upgrade process consists of three phases for each version of each module:
@@ -140,7 +140,7 @@ The upgrade process consists of three phases for each version of each module:
140140 #. The post-phase, after the module and its dependencies are loaded and upgraded.
141141 #. The end-phase, after all modules have been loaded and upgraded for that version.
142142
143- Migration scripts are grouped according to the first part of their filenames into the corresponding
143+ Upgrade scripts are grouped according to the first part of their filenames into the corresponding
144144phase. Within each phase, the files are executed according to their lexical order.
145145
146146.. note ::
0 commit comments