Skip to content

Commit

Permalink
feat: migrate vertex_builds to sql database
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Jul 26, 2024
1 parent b604640 commit 6e67953
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""create vertex_builds table
Revision ID: 0d60fcbd4e8e
Revises: 90be8e2ed91e
Create Date: 2024-07-26 11:41:31.274271
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel
from sqlalchemy.engine.reflection import Inspector

Check failure on line 13 in src/backend/base/langflow/alembic/versions/0d60fcbd4e8e_create_vertex_builds_table.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (F401)

src/backend/base/langflow/alembic/versions/0d60fcbd4e8e_create_vertex_builds_table.py:13:42: F401 `sqlalchemy.engine.reflection.Inspector` imported but unused
from langflow.utils import migration


# revision identifiers, used by Alembic.
revision: str = '0d60fcbd4e8e'
down_revision: Union[str, None] = '90be8e2ed91e'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
conn = op.get_bind()
if not migration.table_exists("vertex_build", conn):
op.create_table(
"vertex_build",
sa.Column("timestamp", sa.DateTime(), nullable=False),
sa.Column("id", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("data", sa.JSON(), nullable=True),
sa.Column("artifacts", sa.JSON(), nullable=True),
sa.Column("params", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("build_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("flow_id", sqlmodel.sql.sqltypes.GUID(), nullable=False),
sa.Column("valid", sqlmodel.sql.sqltypes.BOOLEAN(), nullable=False),
sa.ForeignKeyConstraint(
["flow_id"],
["flow.id"],
),
sa.PrimaryKeyConstraint("build_id"),
)
pass


def downgrade() -> None:
conn = op.get_bind()
if migration.table_exists("vertex_build", conn):
op.drop_table("vertex_build")
pass

0 comments on commit 6e67953

Please sign in to comment.