diff options
author | iElectric <unknown> | 2009-06-27 14:13:27 +0000 |
---|---|---|
committer | iElectric <unknown> | 2009-06-27 14:13:27 +0000 |
commit | 9f7ab96881415ec6bd7fc7729f5196d75d01b8ab (patch) | |
tree | 3eef10782c578b10b1e2186fcec0d07aa43d15ba /migrate/changeset/databases/mysql.py | |
parent | a8c31eb25f89542c9be72d0a8f90b4d984b6aead (diff) | |
download | sqlalchemy-migrate-9f7ab96881415ec6bd7fc7729f5196d75d01b8ab.tar.gz |
- completely refactored ColumnDelta to extract differences between columns/parameters (also fixes issue #23)
- fixed some bugs (passing server_default) on column.alter
- updated tests, specially ColumnDelta and column.alter
- introduced alter_metadata which can preserve altering existing objects if False (defaults to True)
- updated documentation
Diffstat (limited to 'migrate/changeset/databases/mysql.py')
-rw-r--r-- | migrate/changeset/databases/mysql.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/migrate/changeset/databases/mysql.py b/migrate/changeset/databases/mysql.py index ea83d2a..5b5a16e 100644 --- a/migrate/changeset/databases/mysql.py +++ b/migrate/changeset/databases/mysql.py @@ -20,19 +20,13 @@ class MySQLColumnDropper(ansisql.ANSIColumnDropper): class MySQLSchemaChanger(MySQLSchemaGenerator, ansisql.ANSISchemaChanger): - def visit_column(self, column): - delta = column.delta - table = column.table - colspec = self.get_column_specification(column) - - if not hasattr(delta, 'result_column'): - # Mysql needs the whole column definition, not just a lone name/type - raise exceptions.NotSupportedError( - "A column object must be present in table to alter it") + def visit_column(self, delta): + table = delta.table + colspec = self.get_column_specification(delta.result_column) + old_col_name = self.preparer.quote(delta.current_name, table.quote) self.start_alter_table(table) - old_col_name = self.preparer.quote(delta.current_name, column.quote) self.append("CHANGE COLUMN %s " % old_col_name) self.append(colspec) self.execute() |