First migration fix: commit after each migration.

sqlite doesn't like complex changes (alter table) to happen
inside a transaction that has already done other things.
And really, each migration should say "I'm done" and commit
its changes.

This is not the full story, but it's the core of it.

Specifially the migration framework should probably do a
rollback "just in case" after each migration.
This commit is contained in:
Elrond 2012-06-14 21:57:24 +02:00
parent 4ba4e27b44
commit b105540141

View File

@ -33,6 +33,7 @@ def ogg_to_webm_audio(db_conn):
file_keynames.update().where(file_keynames.c.name == 'ogg'). file_keynames.update().where(file_keynames.c.name == 'ogg').
values(name='webm_audio') values(name='webm_audio')
) )
db_conn.commit()
@RegisterMigration(2, MIGRATIONS) @RegisterMigration(2, MIGRATIONS)
@ -45,3 +46,4 @@ def add_wants_notification_column(db_conn):
col = Column('wants_comment_notification', Boolean, col = Column('wants_comment_notification', Boolean,
default=True, nullable=True) default=True, nullable=True)
col.create(users, populate_defaults=True) col.create(users, populate_defaults=True)
db_conn.commit()