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"""