mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
additional message #348
This commit is contained in:
parent
bf9c849467
commit
3ca073779e
1 changed files with 3 additions and 0 deletions
|
@ -44,6 +44,8 @@ def upgrade():
|
||||||
new_id = users[0].id
|
new_id = users[0].id
|
||||||
old_ids = [user.id for user in users[1:]]
|
old_ids = [user.id for user in users[1:]]
|
||||||
|
|
||||||
|
print(profile_id)
|
||||||
|
|
||||||
if old_ids:
|
if old_ids:
|
||||||
# Update tables with batch IN clause
|
# Update tables with batch IN clause
|
||||||
conn.execute(text('UPDATE "post" SET user_id = :new_id WHERE user_id IN :old_ids'), {"new_id": new_id, "old_ids": tuple(old_ids)})
|
conn.execute(text('UPDATE "post" SET user_id = :new_id WHERE user_id IN :old_ids'), {"new_id": new_id, "old_ids": tuple(old_ids)})
|
||||||
|
@ -81,6 +83,7 @@ def upgrade():
|
||||||
|
|
||||||
# Finalize by dropping and recreating the unique index on ap_profile_id
|
# Finalize by dropping and recreating the unique index on ap_profile_id
|
||||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
|
print('Adding unique index...')
|
||||||
batch_op.drop_index('ix_user_ap_profile_id')
|
batch_op.drop_index('ix_user_ap_profile_id')
|
||||||
batch_op.create_index(batch_op.f('ix_user_ap_profile_id'), ['ap_profile_id'], unique=True)
|
batch_op.create_index(batch_op.f('ix_user_ap_profile_id'), ['ap_profile_id'], unique=True)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue