From d75fb49bf2adcf1cdab25a4b8281893ba713c00b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 7 Aug 2023 10:25:46 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20chore(alembic):=20remove=20FlowS?= =?UTF-8?q?tyles=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes the FlowStyles table from the database. The table was no longer needed and has been dropped. The corresponding indexes and foreign key constraints have also been removed. Downgrade functionality has been implemented to recreate the FlowStyles table and its associated indexes and foreign key constraints if needed. --- .../921920b95d3a_remove_flowstyles_table.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/backend/langflow/alembic/versions/921920b95d3a_remove_flowstyles_table.py diff --git a/src/backend/langflow/alembic/versions/921920b95d3a_remove_flowstyles_table.py b/src/backend/langflow/alembic/versions/921920b95d3a_remove_flowstyles_table.py new file mode 100644 index 000000000..7bb550fdf --- /dev/null +++ b/src/backend/langflow/alembic/versions/921920b95d3a_remove_flowstyles_table.py @@ -0,0 +1,63 @@ +"""Remove FlowStyles table + +Revision ID: 921920b95d3a +Revises: 4814b6f4abfd +Create Date: 2023-08-07 10:22:54.503716 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = "921920b95d3a" +down_revision: Union[str, None] = "4814b6f4abfd" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index("ix_component_frontend_node_id", table_name="component") + op.drop_index("ix_component_name", table_name="component") + op.drop_table("component") + op.drop_table("flowstyle") + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table( + "flowstyle", + sa.Column("color", sa.VARCHAR(), nullable=False), + sa.Column("emoji", sa.VARCHAR(), nullable=False), + sa.Column("flow_id", sa.CHAR(length=32), nullable=True), + sa.Column("id", sa.CHAR(length=32), nullable=False), + sa.ForeignKeyConstraint( + ["flow_id"], + ["flow.id"], + ), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("id"), + ) + op.create_table( + "component", + sa.Column("id", sa.CHAR(length=32), nullable=False), + sa.Column("frontend_node_id", sa.CHAR(length=32), nullable=False), + sa.Column("name", sa.VARCHAR(), nullable=False), + sa.Column("description", sa.VARCHAR(), nullable=True), + sa.Column("python_code", sa.VARCHAR(), nullable=True), + sa.Column("return_type", sa.VARCHAR(), nullable=True), + sa.Column("is_disabled", sa.BOOLEAN(), nullable=False), + sa.Column("is_read_only", sa.BOOLEAN(), nullable=False), + sa.Column("create_at", sa.DATETIME(), nullable=False), + sa.Column("update_at", sa.DATETIME(), nullable=False), + sa.PrimaryKeyConstraint("id"), + ) + op.create_index("ix_component_name", "component", ["name"], unique=False) + op.create_index( + "ix_component_frontend_node_id", "component", ["frontend_node_id"], unique=False + ) + # ### end Alembic commands ###