🔥 chore(alembic): remove flowstyles table

 feat(alembic): add migration to remove flowstyles table

🔥 chore(alembic): remove old migration file for removing flowstyles table

🐛 fix(database): import Flow model to avoid unused import warning
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-07 14:09:27 -03:00
commit 71012ac47b
3 changed files with 43 additions and 63 deletions

View file

@ -0,0 +1,42 @@
"""Remove FlowStyles table
Revision ID: 0a534bdfd84b
Revises: 4814b6f4abfd
Create Date: 2023-08-07 14:09:06.844104
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0a534bdfd84b"
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_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"),
)
# ### end Alembic commands ###

View file

@ -1,63 +0,0 @@
"""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 ###

View file

@ -4,6 +4,7 @@ from sqlmodel import SQLModel, Session, create_engine
from langflow.utils.logger import logger
from alembic.config import Config
from alembic import command
from .models import Flow # noqa: F401
class DatabaseManager(Service):