Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add 'gradient' column to Flow model and database schema #3944

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ###
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class FlowBase(SQLModel):
description: str | None = Field(default=None, sa_column=Column(Text, index=True, nullable=True))
icon: str | None = Field(default=None, nullable=True)
icon_bg_color: str | None = Field(default=None, nullable=True)
gradient: str | None = Field(default=None, nullable=True)
data: dict | None = Field(default=None, nullable=True)
is_component: bool | None = Field(default=False, nullable=True)
updated_at: datetime | None = Field(default_factory=lambda: datetime.now(timezone.utc), nullable=True)
Expand Down
Loading