diff options
author | chrisw <unknown> | 2010-09-09 09:15:28 +0100 |
---|---|---|
committer | chrisw <unknown> | 2010-09-09 09:15:28 +0100 |
commit | 5cf42fbf76b035516d55ca0f1d7e95bb7365ae10 (patch) | |
tree | 2f42f499ba24452552005bc565e590a59a591824 /migrate/changeset/databases/sqlite.py | |
parent | dceff55ff41235cad7b9d53b51e9525ffabc4ca0 (diff) | |
download | sqlalchemy-migrate-5cf42fbf76b035516d55ca0f1d7e95bb7365ae10.tar.gz |
fix for issue 96: deleting a column in sqlite shouldn't delete all indexes
bonus: remove_from_table now removes indexes
Diffstat (limited to 'migrate/changeset/databases/sqlite.py')
-rw-r--r-- | migrate/changeset/databases/sqlite.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/migrate/changeset/databases/sqlite.py b/migrate/changeset/databases/sqlite.py index 01c3642..4136af3 100644 --- a/migrate/changeset/databases/sqlite.py +++ b/migrate/changeset/databases/sqlite.py @@ -35,11 +35,10 @@ class SQLiteHelper(SQLiteCommon): table = self._to_table(column.table) table_name = self.preparer.format_table(table) - # we remove all constraints, indexes so it doesnt recreate them - ixbackup = copy(table.indexes) - consbackup = copy(table.constraints) - table.indexes = set() - table.constraints = set() + # we remove all indexes so as not to have + # problems during copy and re-create + for index in table.indexes: + index.drop() self.append('ALTER TABLE %s RENAME TO migration_tmp' % table_name) self.execute() @@ -52,10 +51,6 @@ class SQLiteHelper(SQLiteCommon): self.append('DROP TABLE migration_tmp') self.execute() - # restore indexes, constraints - table.indexes = ixbackup - table.constraints = consbackup - class SQLiteColumnGenerator(SQLiteSchemaGenerator, SQLiteCommon, ansisql.ANSIColumnGenerator): """SQLite ColumnGenerator""" |