Fix the token issues in the migration
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 18 Feb 2015 02:04:15 +0000 (20:04 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 18 Feb 2015 02:04:15 +0000 (20:04 -0600)
There's no .id on access/request token tables, so fixed to use the .token field.

Also switched a reference of client_table -> rt_table

mediagoblin/db/migrations.py

index 8e54953e211a51cfe41470bc42f9099d26903ee9..74c1194fe078b4aa875596083d91dd03c22617dd 100644 (file)
@@ -1162,10 +1162,10 @@ def datetime_to_utc(db):
     # Convert RequestToken
     rt_table = inspect_table(metadata, "core__request_tokens")
     for request_token in db.execute(rt_table.select()):
-        db.execute(client_table.update().values(
+        db.execute(rt_table.update().values(
             created=dt_to_utc(request_token.created),
             updated=dt_to_utc(request_token.updated)
-        ).where(rt_table.c.id==request_token.id))
+        ).where(rt_table.c.token==request_token.token))
 
     # Convert AccessToken
     at_table = inspect_table(metadata, "core__access_tokens")
@@ -1173,7 +1173,7 @@ def datetime_to_utc(db):
         db.execute(at_table.update().values(
             created=dt_to_utc(access_token.created),
             updated=dt_to_utc(access_token.updated)
-        ).where(at_table.c.id==access_token.id))
+        ).where(at_table.c.token==access_token.token))
 
     # Convert MediaEntry
     media_table = inspect_table(metadata, "core__media_entries")