summaryrefslogtreecommitdiff
path: root/migrate/changeset/databases/sqlite.py
diff options
context:
space:
mode:
authorchrisw <unknown>2010-09-09 09:15:28 +0100
committerchrisw <unknown>2010-09-09 09:15:28 +0100
commit5cf42fbf76b035516d55ca0f1d7e95bb7365ae10 (patch)
tree2f42f499ba24452552005bc565e590a59a591824 /migrate/changeset/databases/sqlite.py
parentdceff55ff41235cad7b9d53b51e9525ffabc4ca0 (diff)
downloadsqlalchemy-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.py13
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"""