This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-10 23:22:08 -06:00
1 parent 1f22cccd22
commit bd8378f643
2 files changed
+65 -4

No files matched your search

@@ -185,9 +185,7 @@ def upgrade() -> None:
for uid, oauth_sub in rows:
if oauth_sub:
provider, sub = oauth_sub.split('@', 1) if '@' in oauth_sub else ('oidc', oauth_sub)
conn.execute(
sa.update(_user).where(_user.c.id == uid).values(oauth=json.dumps({provider: {'sub': sub}}))
)
conn.execute(sa.update(_user).where(_user.c.id == uid).values(oauth={provider: {'sub': sub}}))
# ── Migrate api_key column → api_key table (only if old column still exists)
if 'api_key' in user_columns:
@@ -226,7 +224,7 @@ def downgrade() -> None:
for uid, oauth in rows:
try:
data = json.loads(oauth)
data = oauth if isinstance(oauth, dict) else json.loads(oauth)
provider = list(data.keys())[0]
sub = data[provider].get('sub')
oauth_sub = f'{provider}@{sub}'