-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'gradient' column to Flow model and database schema
- Loading branch information
1 parent
df792cb
commit 736d425
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/backend/base/langflow/alembic/versions/d3dbf656a499_add_gradient_column_in_flow.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,41 @@ | ||
"""add gradient column in Flow | ||
Revision ID: d3dbf656a499 | ||
Revises: e5a65ecff2cd | ||
Create Date: 2024-09-27 09:35:19.424089 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
import sqlmodel | ||
from alembic import op | ||
from sqlalchemy.engine.reflection import Inspector | ||
|
||
from langflow.utils import migration | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'd3dbf656a499' | ||
down_revision: Union[str, None] = 'e5a65ecff2cd' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
conn = op.get_bind() | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('flow', schema=None) as batch_op: | ||
if not migration.column_exists(table_name='flow', column_name='gradient', conn=conn): | ||
batch_op.add_column(sa.Column('gradient', sqlmodel.sql.sqltypes.AutoString(), nullable=True)) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
conn = op.get_bind() | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('flow', schema=None) as batch_op: | ||
if migration.column_exists(table_name='flow', column_name='gradient', conn=conn): | ||
batch_op.drop_column('gradient') | ||
|
||
# ### end Alembic commands ### |
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