← Back to team overview

credativ team mailing list archive

[Merge] lp:~therp-nl/openupgrade-server/7.0-API-rename_columns_magic into lp:openupgrade-server

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/7.0-API-rename_columns_magic into lp:openupgrade-server.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-API-rename_columns_magic/+merge/175812
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-API-rename_columns_magic/+merge/175812
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-API-rename_columns_magic into lp:openupgrade-server.
=== modified file 'openerp/openupgrade/openupgrade.py'
--- openerp/openupgrade/openupgrade.py	2013-06-11 08:09:44 +0000
+++ openerp/openupgrade/openupgrade.py	2013-07-19 11:42:25 +0000
@@ -100,11 +100,13 @@
     Rename table columns. Typically called in the pre script.
 
     :param column_spec: a hash with table keys, with lists of tuples as values. \
-    Tuples consist of (old_name, new_name).
-
+    Tuples consist of (old_name, new_name). Use None for new_name to trigger a \
+    conversion of old_name using get_legacy_name()
     """
     for table in column_spec.keys():
         for (old, new) in column_spec[table]:
+            if new is None:
+                new = get_legacy_name(old)
             logger.info("table %s, column %s: renaming to %s",
                      table, old, new)
             cr.execute('ALTER TABLE "%s" RENAME "%s" TO "%s"' % (table, old, new,))


Follow ups