Add the required migration for time machine tag lifetimes.

This commit is contained in:
Jake Moshenko 2015-02-13 14:41:08 -05:00
parent 5aedd1fabc
commit 2ce6e76d9d
3 changed files with 39 additions and 3 deletions

View file

@ -15,7 +15,7 @@ def backfill_user_uuids():
# Check to see if any users are missing uuids.
has_missing_uuids = True
try:
User.select().where(User.uuid >> None).get()
User.select(User.id).where(User.uuid >> None).get()
except User.DoesNotExist:
has_missing_uuids = False
@ -39,9 +39,9 @@ def backfill_user_uuids():
for user_id in batch_user_ids:
with app.config['DB_TRANSACTION_FACTORY'](db):
try:
user = User.get(User.id == user_id)
user = User.select(User.id, User.uuid).where(User.id == user_id).get()
user.uuid = str(uuid.uuid4())
user.save()
user.save(only=[User.uuid])
except User.DoesNotExist:
pass