Merge lp:~therp-nl/openupgrade-server/6.0-lp983731-rename_orm_table_sequences into lp:openupgrade-server/6.0

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 3490
Proposed branch: lp:~therp-nl/openupgrade-server/6.0-lp983731-rename_orm_table_sequences
Merge into: lp:openupgrade-server/6.0
Prerequisite: lp:~therp-nl/openupgrade-server/6.0-API_and_loading_improvements
Diff against target: 32 lines (+11/-2)
1 file modified
bin/openupgrade/openupgrade.py (+11/-2)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-server/6.0-lp983731-rename_orm_table_sequences
Reviewer Review Type Date Requested Status
OpenUpgrade Committers Pending
Review via email: mp+109213@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/openupgrade/openupgrade.py'
--- bin/openupgrade/openupgrade.py 2012-06-07 18:57:21 +0000
+++ bin/openupgrade/openupgrade.py 2012-06-07 18:57:21 +0000
@@ -108,9 +108,18 @@
108def rename_tables(cr, table_spec):108def rename_tables(cr, table_spec):
109 """109 """
110 Rename tables. Typically called in the pre script.110 Rename tables. Typically called in the pre script.
111 :param column_spec: a list of tuples (old table name, new table name).111 This function also renames the id sequence if it exists and if it is
112 not modified in the same run.
113
114 :param table_spec: a list of tuples (old table name, new table name).
112115
113 """116 """
117 # Append id sequences
118 to_rename = [x[0] for x in table_spec]
119 for old, new in list(table_spec):
120 if (table_exists(cr, old + '_id_seq') and
121 old + '_id_seq' not in to_rename):
122 table_spec.append((old + '_id_seq', new + '_id_seq'))
114 for (old, new) in table_spec:123 for (old, new) in table_spec:
115 logger.info("table %s: renaming to %s",124 logger.info("table %s: renaming to %s",
116 old, new)125 old, new)
@@ -119,7 +128,7 @@
119def rename_models(cr, model_spec):128def rename_models(cr, model_spec):
120 """129 """
121 Rename models. Typically called in the pre script.130 Rename models. Typically called in the pre script.
122 :param column_spec: a list of tuples (old model name, new model name).131 :param model_spec: a list of tuples (old model name, new model name).
123 132
124 Use case: if a model changes name, but still implements equivalent133 Use case: if a model changes name, but still implements equivalent
125 functionality you will want to update references in for instance134 functionality you will want to update references in for instance

Subscribers

People subscribed via source and target branches