From 9604ace08417af8851e5db7ac9dbdc70b73b6dad Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 28 Aug 2023 14:45:30 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20chore(adds=5Ftables.py):=20remov?= =?UTF-8?q?e=20'flowstyle'=20table=20and=20related=20indices=20if=20it=20e?= =?UTF-8?q?xists=20during=20upgrade=20to=20ensure=20data=20consistency=20?= =?UTF-8?q?=F0=9F=94=A5=20chore(adds=5Ftables.py):=20remove=20'flowstyle'?= =?UTF-8?q?=20table=20and=20related=20indices=20if=20it=20exists=20during?= =?UTF-8?q?=20downgrade=20to=20ensure=20data=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alembic/versions/260dbcc8b680_adds_tables.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backend/langflow/alembic/versions/260dbcc8b680_adds_tables.py b/src/backend/langflow/alembic/versions/260dbcc8b680_adds_tables.py index 99467d045..4679a7df1 100644 --- a/src/backend/langflow/alembic/versions/260dbcc8b680_adds_tables.py +++ b/src/backend/langflow/alembic/versions/260dbcc8b680_adds_tables.py @@ -26,6 +26,15 @@ def upgrade() -> None: inspector = Inspector.from_engine(conn) # List existing tables existing_tables = inspector.get_table_names() + # Drop 'flowstyle' table if it exists + # and other related indices + if "flowstyle" in existing_tables: + op.drop_table("flowstyle") + if "ix_flowstyle_flow_id" in [ + index["name"] for index in inspector.get_indexes("flowstyle") + ]: + op.drop_index("ix_flowstyle_flow_id", table_name="flowstyle") + existing_indices_flow = [] existing_fks_flow = [] if "flow" in existing_tables: @@ -159,4 +168,10 @@ def downgrade() -> None: batch_op.drop_index(batch_op.f("ix_user_username")) op.drop_table("user") + + if "flowstyle" in existing_tables: + op.drop_table("flowstyle") + + if "component" in existing_tables: + op.drop_table("component") # ### end Alembic commands ###