🔧 chore(update_all_tables.py): add missing index and foreign key constraints to apikey table
🔧 chore(update_all_tables.py): add missing index and foreign key constraints to flow table
This commit is contained in:
parent
8b99cc06c4
commit
648bb25b3f
1 changed files with 10 additions and 8 deletions
|
|
@ -27,19 +27,21 @@ def upgrade() -> None:
|
||||||
op.add_column(
|
op.add_column(
|
||||||
"apikey", sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False)
|
"apikey", sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False)
|
||||||
)
|
)
|
||||||
|
op.create_index(op.f("ix_apikey_user_id"), "apikey", ["user_id"], unique=False)
|
||||||
|
op.create_foreign_key(None, "apikey", "user", ["user_id"], ["id"])
|
||||||
with contextlib.suppress(sa.exc.OperationalError):
|
with contextlib.suppress(sa.exc.OperationalError):
|
||||||
op.alter_column("apikey", "name", existing_type=sa.VARCHAR(), nullable=True)
|
op.alter_column("apikey", "name", existing_type=sa.VARCHAR(), nullable=True)
|
||||||
with contextlib.suppress(sa.exc.OperationalError):
|
|
||||||
op.create_index(op.f("ix_apikey_name"), "apikey", ["name"], unique=False)
|
op.create_index(op.f("ix_apikey_name"), "apikey", ["name"], unique=False)
|
||||||
op.create_index(op.f("ix_apikey_user_id"), "apikey", ["user_id"], unique=False)
|
|
||||||
op.create_foreign_key(None, "apikey", "user", ["user_id"], ["id"])
|
|
||||||
with contextlib.suppress(sa.exc.OperationalError):
|
with contextlib.suppress(sa.exc.OperationalError):
|
||||||
op.drop_column("apikey", "create_at")
|
op.drop_column("apikey", "create_at")
|
||||||
op.add_column(
|
with contextlib.suppress(sa.exc.OperationalError):
|
||||||
"flow", sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False)
|
op.add_column(
|
||||||
)
|
"flow", sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False)
|
||||||
op.create_index(op.f("ix_flow_user_id"), "flow", ["user_id"], unique=False)
|
)
|
||||||
op.create_foreign_key(None, "flow", "user", ["user_id"], ["id"])
|
with contextlib.suppress(sa.exc.OperationalError):
|
||||||
|
op.create_index(op.f("ix_flow_user_id"), "flow", ["user_id"], unique=False)
|
||||||
|
op.create_foreign_key(None, "flow", "user", ["user_id"], ["id"])
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue