Skip to content

Commit

Permalink
feat: add token column
Browse files Browse the repository at this point in the history
  • Loading branch information
Aydawka committed Jul 19, 2024
1 parent 7f9fa58 commit b13c3e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alembic/versions/df71df391cdb_add_token_to_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from alembic import op
import sqlalchemy as sa
import uuid


# revision identifiers, used by Alembic.
Expand All @@ -17,10 +18,14 @@
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

password_reset_token = str(uuid.uuid4())


def upgrade() -> None:
op.add_column(
"user", sa.Column("password_reset_token", sa.String, nullable=True)
)
op.execute(f"UPDATE \"user\" SET password_reset_token ='{password_reset_token}'")

with op.batch_alter_table("user") as batch_op:
batch_op.alter_column("password_reset_token", nullable=False)

0 comments on commit b13c3e9

Please sign in to comment.