Skip to content

Commit 6fdab83

Browse files
committed
Fix empty fs_uniquifier for existing users.
Fixes #109 Thanks for all your help @hgy59 @mreid-tt
1 parent 8a5521e commit 6fdab83

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

migrations/versions/76d559b4e873_add_fs_uniquifier.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@
1313

1414

1515
def upgrade():
16-
# ### commands auto generated by Alembic - please adjust! ###
1716
op.add_column(
18-
"user", sa.Column("fs_uniquifier", sa.String(length=255), nullable=False)
17+
"user",
18+
sa.Column(
19+
"fs_uniquifier",
20+
sa.String(length=255),
21+
nullable=False,
22+
server_default=sa.text("md5(random()::text)"),
23+
),
1924
)
20-
op.create_unique_constraint(None, "user", ["fs_uniquifier"])
21-
# ### end Alembic commands ###
25+
op.create_unique_constraint("user_fs_uniquifier_key", "user", ["fs_uniquifier"])
2226

2327

2428
def downgrade():
25-
# ### commands auto generated by Alembic - please adjust! ###
26-
op.drop_constraint(None, "user", type_="unique")
29+
op.drop_constraint("user_fs_uniquifier_key", "user", type_="unique")
2730
op.drop_column("user", "fs_uniquifier")
28-
# ### end Alembic commands ###

0 commit comments

Comments
 (0)