From 648bb25b3f6dc7a11138f487f280360ad389a924 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 25 Aug 2023 15:31:16 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(update=5Fall=5Ftables.py):?= =?UTF-8?q?=20add=20missing=20index=20and=20foreign=20key=20constraints=20?= =?UTF-8?q?to=20apikey=20table=20=F0=9F=94=A7=20chore(update=5Fall=5Ftable?= =?UTF-8?q?s.py):=20add=20missing=20index=20and=20foreign=20key=20constrai?= =?UTF-8?q?nts=20to=20flow=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../versions/d3749cf7ac7e_update_all_tables.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/backend/langflow/alembic/versions/d3749cf7ac7e_update_all_tables.py b/src/backend/langflow/alembic/versions/d3749cf7ac7e_update_all_tables.py index 13c0266e7..f45034d40 100644 --- a/src/backend/langflow/alembic/versions/d3749cf7ac7e_update_all_tables.py +++ b/src/backend/langflow/alembic/versions/d3749cf7ac7e_update_all_tables.py @@ -27,19 +27,21 @@ def upgrade() -> None: op.add_column( "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): 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_user_id"), "apikey", ["user_id"], unique=False) - op.create_foreign_key(None, "apikey", "user", ["user_id"], ["id"]) + with contextlib.suppress(sa.exc.OperationalError): op.drop_column("apikey", "create_at") - 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.add_column( + "flow", sa.Column("user_id", sqlmodel.sql.sqltypes.GUID(), nullable=False) + ) + 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 ###