Skip to content

Commit 36a6a30

Browse files
authored
Fix unique constraints and column nullability (#1348)
This pull request tries to fix the unique constraints and column nullability in the codebase.
2 parents bc4cab1 + e4cbe9c commit 36a6a30

8 files changed

+32
-22
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "langflow"
3-
version = "0.6.5a6"
3+
version = "0.6.5a7"
44
description = "A Python package with a built-in web application"
55
authors = ["Logspace <[email protected]>"]
66
maintainers = [

src/backend/langflow/alembic/versions/006b3990db50_add_unique_constraints.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def upgrade() -> None:
2727

2828
with op.batch_alter_table('user', schema=None) as batch_op:
2929
batch_op.create_unique_constraint('uq_user_id', ['id'])
30-
except Exception:
30+
except Exception as e:
31+
print(e)
3132
pass
3233

3334
# ### end Alembic commands ###
@@ -44,6 +45,7 @@ def downgrade() -> None:
4445

4546
with op.batch_alter_table('apikey', schema=None) as batch_op:
4647
batch_op.drop_constraint('uq_apikey_id', type_='unique')
47-
except Exception:
48+
except Exception as e:
49+
print(e)
4850
pass
4951
# ### end Alembic commands ###

src/backend/langflow/alembic/versions/2ac71eb9c3ae_adds_credential_table.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ def upgrade() -> None:
2929
sa.Column('id', sqlmodel.sql.sqltypes.GUID(), nullable=False),
3030
sa.Column('created_at', sa.DateTime(), nullable=False),
3131
sa.Column('updated_at', sa.DateTime(), nullable=True),
32-
sa.PrimaryKeyConstraint('id', name=op.f('pk_credential')),
32+
sa.PrimaryKeyConstraint('id'),
3333
)
34-
except Exception:
34+
except Exception as e:
35+
print(e)
3536
pass
3637
# ### end Alembic commands ###
3738

@@ -40,6 +41,7 @@ def downgrade() -> None:
4041
# ### commands auto generated by Alembic - please adjust! ###
4142
try:
4243
op.drop_table('credential')
43-
except Exception:
44+
except Exception as e:
45+
print(e)
4446
pass
4547
# ### end Alembic commands ###

src/backend/langflow/alembic/versions/7843803a87b5_store_updates.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def downgrade() -> None:
4545

4646
with op.batch_alter_table("flow", schema=None) as batch_op:
4747
batch_op.drop_column("is_component")
48-
except Exception:
48+
except Exception as e:
49+
print(e)
4950
pass
5051
# ### end Alembic commands ###

src/backend/langflow/alembic/versions/7d2162acc8b2_adds_updated_at_and_folder_cols.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def upgrade() -> None:
3737
with op.batch_alter_table('flow', schema=None) as batch_op:
3838
batch_op.add_column(sa.Column('updated_at', sa.DateTime(), nullable=True))
3939
batch_op.add_column(sa.Column('folder', sqlmodel.sql.sqltypes.AutoString(), nullable=True))
40-
4140
# ### end Alembic commands ###
4241

4342

@@ -67,8 +66,8 @@ def downgrade() -> None:
6766
sa.Column('flow_id', sa.CHAR(length=32), nullable=True),
6867
sa.Column('id', sa.CHAR(length=32), nullable=False),
6968
sa.ForeignKeyConstraint(['flow_id'], ['flow.id'], ),
70-
sa.PrimaryKeyConstraint('id', name=op.f('pk_flowstyle'))
71-
sa.UniqueConstraint('id', name=op.f('uq_flowstyle_id'))
69+
sa.PrimaryKeyConstraint('id'),
70+
sa.UniqueConstraint('id')
7271
)
7372
op.create_table('component',
7473
sa.Column('id', sa.CHAR(length=32), nullable=False),
@@ -81,7 +80,7 @@ def downgrade() -> None:
8180
sa.Column('is_read_only', sa.BOOLEAN(), nullable=False),
8281
sa.Column('create_at', sa.DATETIME(), nullable=False),
8382
sa.Column('update_at', sa.DATETIME(), nullable=False),
84-
sa.PrimaryKeyConstraint('id', name=op.f('pk_component'))
83+
sa.PrimaryKeyConstraint('id')
8584
)
8685

8786
with op.batch_alter_table('component', schema=None) as batch_op:

src/backend/langflow/alembic/versions/eb5866d51fd2_change_columns_to_be_nullable.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ def upgrade() -> None:
2929
except exc.SQLAlchemyError:
3030
# connection.execute(text("ROLLBACK"))
3131
pass
32-
except Exception:
32+
except Exception as e:
33+
print(e)
3334
pass
3435

3536
try:
3637
op.drop_table("component")
3738
except exc.SQLAlchemyError:
3839
# connection.execute(text("ROLLBACK"))
3940
pass
40-
except Exception:
41+
except Exception as e:
42+
print(e)
4143
pass
4244
# ### end Alembic commands ###
4345

@@ -64,7 +66,8 @@ def downgrade() -> None:
6466
batch_op.create_index(
6567
"ix_component_frontend_node_id", ["frontend_node_id"], unique=False
6668
)
67-
except Exception:
69+
except Exception as e:
70+
print(e)
6871
pass
6972

7073
try:
@@ -81,6 +84,7 @@ def downgrade() -> None:
8184
sa.PrimaryKeyConstraint("id", name="pk_flowstyle"),
8285
sa.UniqueConstraint("id", name="uq_flowstyle_id"),
8386
)
84-
except Exception:
87+
except Exception as e:
88+
print(e)
8589
pass
8690
# ### end Alembic commands ###

src/backend/langflow/alembic/versions/f5ee9749d1a6_user_id_can_be_null_in_flow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
"""
88
from typing import Sequence, Union
99

10-
from alembic import op
1110
import sqlalchemy as sa
12-
import sqlmodel
13-
11+
from alembic import op
1412

1513
# revision identifiers, used by Alembic.
1614
revision: str = "f5ee9749d1a6"
@@ -26,7 +24,8 @@ def upgrade() -> None:
2624
batch_op.alter_column(
2725
"user_id", existing_type=sa.CHAR(length=32), nullable=True
2826
)
29-
except Exception:
27+
except Exception as e:
28+
print(e)
3029
pass
3130

3231
# ### end Alembic commands ###
@@ -39,7 +38,8 @@ def downgrade() -> None:
3938
batch_op.alter_column(
4039
"user_id", existing_type=sa.CHAR(length=32), nullable=False
4140
)
42-
except Exception:
41+
except Exception as e:
42+
print(e)
4343
pass
4444

4545
# ### end Alembic commands ###

src/backend/langflow/alembic/versions/fd531f8868b1_fix_credential_table.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def upgrade() -> None:
2121
try:
2222
with op.batch_alter_table('credential', schema=None) as batch_op:
2323
batch_op.create_foreign_key("fk_credential_user_id", 'user', ['user_id'], ['id'])
24-
except Exception:
24+
except Exception as e:
25+
print(e)
2526
pass
2627

2728
# ### end Alembic commands ###
@@ -32,7 +33,8 @@ def downgrade() -> None:
3233
try:
3334
with op.batch_alter_table('credential', schema=None) as batch_op:
3435
batch_op.drop_constraint("fk_credential_user_id", type_='foreignkey')
35-
except Exception:
36+
except Exception as e:
37+
print(e)
3638
pass
3739

3840
# ### end Alembic commands ###

0 commit comments

Comments
 (0)