22 lines
802 B
Python
22 lines
802 B
Python
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "20260419_client_portal_user_link"
|
|
down_revision = "20260416_release_b6_cleanup"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
with op.batch_alter_table("clients") as batch_op:
|
|
batch_op.add_column(sa.Column("portal_user_id", sa.Integer(), nullable=True))
|
|
batch_op.create_index("ix_clients_portal_user_id", ["portal_user_id"], unique=False)
|
|
batch_op.create_foreign_key("fk_clients_portal_user_id_users", "users", ["portal_user_id"], ["id"])
|
|
|
|
|
|
def downgrade():
|
|
with op.batch_alter_table("clients") as batch_op:
|
|
batch_op.drop_constraint("fk_clients_portal_user_id_users", type_="foreignkey")
|
|
batch_op.drop_index("ix_clients_portal_user_id")
|
|
batch_op.drop_column("portal_user_id")
|