Merge "Fix race conditions in migration 061"

This commit is contained in:
Jenkins 2015-12-31 20:06:38 +00:00 committed by Gerrit Code Review
commit 13013e1aea

View File

@ -25,16 +25,6 @@ def upgrade(migrate_engine):
data_timestamp = Column('data_timestamp', DateTime)
backups.create_column(snapshot_id)
backups.update().values(snapshot_id=None).execute()
backups.create_column(data_timestamp)
backups.update().values(data_timestamp=None).execute()
# Copy existing created_at timestamp to data_timestamp
# in the backups table.
backups_list = list(backups.select().execute())
for backup in backups_list:
backup_id = backup.id
backups.update().\
where(backups.c.id == backup_id).\
values(data_timestamp=backup.created_at).execute()
backups.update().values(data_timestamp=backups.c.created_at).execute()