feat(sso): migration — add keycloak_sub, make hashed_password nullable
This commit is contained in:
25
backend/alembic/versions/0002_keycloak_sso.py
Normal file
25
backend/alembic/versions/0002_keycloak_sso.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
"""add keycloak_sub, make hashed_password nullable
|
||||||
|
|
||||||
|
Revision ID: 0002
|
||||||
|
Revises: 0001
|
||||||
|
Create Date: 2026-03-01
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
revision = "0002"
|
||||||
|
down_revision = "0001"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column("users", sa.Column("keycloak_sub", sa.String(255), nullable=True))
|
||||||
|
op.create_unique_constraint("uq_users_keycloak_sub", "users", ["keycloak_sub"])
|
||||||
|
op.alter_column("users", "hashed_password", nullable=True)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.alter_column("users", "hashed_password", nullable=False)
|
||||||
|
op.drop_constraint("uq_users_keycloak_sub", "users", type_="unique")
|
||||||
|
op.drop_column("users", "keycloak_sub")
|
||||||
Reference in New Issue
Block a user