code: def copy_columns(cr, column_spec):
      
      for table_name in column_spec.keys():
          for (old, new, field_type) in column_spec[table_name]:
              if new is None:
                  new = get_legacy_name(old)
              if field_type is None:
                  cr.execute("""
                      SELECT data_type
                      FROM information_schema.columns
                      WHERE table_name=%s
                          AND column_name = %s;
                      """, (table_name, old))
                  field_type = cr.fetchone()[0]
              logged_query(cr, """
                  ALTER TABLE %(table_name)s
                  ADD COLUMN %(new)s %(field_type)s;
                  UPDATE %(table_name)s SET %(new)s=%(old)s;
                  """ % {
                  'table_name': table_name,
                  'old': old,
                  'field_type': field_type,
                  'new': new,
              })
docs: Copy 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, type). Use None for
          new_name to trigger a conversion of old_name using get_legacy_name()
          Use None for type to use type of old field.
          Make sure to quote properly, if your column name coincides with a
          SQL directive. eg. '"column"'
  
      .. versionadded:: 8.0