Skip to content

Commit

Permalink
Fix empty fs_uniquifier for existing users.
Browse files Browse the repository at this point in the history
Fixes #109
Thanks for all your help @hgy59 @mreid-tt
  • Loading branch information
publicarray committed Jan 1, 2024
1 parent 8a5521e commit 6fdab83
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions migrations/versions/76d559b4e873_add_fs_uniquifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"user", sa.Column("fs_uniquifier", sa.String(length=255), nullable=False)
"user",
sa.Column(
"fs_uniquifier",
sa.String(length=255),
nullable=False,
server_default=sa.text("md5(random()::text)"),
),
)
op.create_unique_constraint(None, "user", ["fs_uniquifier"])
# ### end Alembic commands ###
op.create_unique_constraint("user_fs_uniquifier_key", "user", ["fs_uniquifier"])


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

0 comments on commit 6fdab83

Please sign in to comment.