diff options
author | Chris Withers <chris@simplistix.co.uk> | 2011-02-10 15:17:28 +0000 |
---|---|---|
committer | Chris Withers <chris@simplistix.co.uk> | 2011-02-10 15:17:28 +0000 |
commit | 500cb6f5df5cbdf19b6155820e6f51e672e64649 (patch) | |
tree | 82d0ffc1e5541259bc9336b82f9cf5df3bfca5a3 /migrate/changeset/databases/sqlite.py | |
parent | b1745bee521b36b3c2e3ca0b224f8cfdbf085400 (diff) | |
download | sqlalchemy-migrate-500cb6f5df5cbdf19b6155820e6f51e672e64649.tar.gz |
fix sqlite column dropper now that the table is only modified after the visitor is run
Diffstat (limited to 'migrate/changeset/databases/sqlite.py')
-rw-r--r-- | migrate/changeset/databases/sqlite.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/migrate/changeset/databases/sqlite.py b/migrate/changeset/databases/sqlite.py index 66a8f5a..01e48ef 100644 --- a/migrate/changeset/databases/sqlite.py +++ b/migrate/changeset/databases/sqlite.py @@ -80,10 +80,19 @@ class SQLiteColumnDropper(SQLiteHelper, ansisql.ANSIColumnDropper): """SQLite ColumnDropper""" def _modify_table(self, table, column, delta): + columns = ' ,'.join(map(self.preparer.format_column, table.columns)) return 'INSERT INTO %(table_name)s SELECT ' + columns + \ ' from migration_tmp' + def visit_column(self,column): + # For SQLite, we *have* to remove the column so the table + # is re-created properly. + # This violates the alter_metadata settting, but that + # is going away... + column.remove_from_table(column.table,unset_table=False) + super(SQLiteColumnDropper,self).visit_column(column) + class SQLiteSchemaChanger(SQLiteHelper, ansisql.ANSISchemaChanger): """SQLite SchemaChanger""" |