diff --git a/src/backend/langflow/alembic/versions/7d2162acc8b2_adds_updated_at_and_folder_cols.py b/src/backend/langflow/alembic/versions/7d2162acc8b2_adds_updated_at_and_folder_cols.py index 0138c0506..13b5a7db7 100644 --- a/src/backend/langflow/alembic/versions/7d2162acc8b2_adds_updated_at_and_folder_cols.py +++ b/src/backend/langflow/alembic/versions/7d2162acc8b2_adds_updated_at_and_folder_cols.py @@ -7,10 +7,9 @@ Create Date: 2023-11-21 20:56:53.998781 """ from typing import Sequence, Union -from alembic import op import sqlalchemy as sa import sqlmodel - +from alembic import op # revision identifiers, used by Alembic. revision: str = '7d2162acc8b2' @@ -41,39 +40,51 @@ def upgrade() -> None: def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('flow', schema=None) as batch_op: - batch_op.drop_column('folder') - batch_op.drop_column('updated_at') + try: + with op.batch_alter_table('flow', schema=None) as batch_op: + batch_op.drop_column('folder') + batch_op.drop_column('updated_at') + except Exception as e: + print(e) + pass - with op.batch_alter_table('apikey', schema=None) as batch_op: - batch_op.alter_column('name', - existing_type=sa.VARCHAR(), - nullable=True) + try: - 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') - ) - with op.batch_alter_table('component', schema=None) as batch_op: - batch_op.create_index('ix_component_name', ['name'], unique=False) - batch_op.create_index('ix_component_frontend_node_id', ['frontend_node_id'], unique=False) + with op.batch_alter_table('apikey', schema=None) as batch_op: + batch_op.alter_column('name', + existing_type=sa.VARCHAR(), + nullable=True) + except Exception as e: + print(e) + pass + try: + 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') + ) + with op.batch_alter_table('component', schema=None) as batch_op: + batch_op.create_index('ix_component_name', ['name'], unique=False) + batch_op.create_index('ix_component_frontend_node_id', ['frontend_node_id'], unique=False) + except Exception as e: + print(e) + pass # ### end Alembic commands ###