-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate vertex_builds to sql database
- Loading branch information
1 parent
b604640
commit 6e67953
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/backend/base/langflow/alembic/versions/0d60fcbd4e8e_create_vertex_builds_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / Ruff Style Check (3.12)Ruff (F401)
|
||
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 |