langflow
langflow copied to clipboard
fix: Problem in the "description" field when using MySQL
Bug Description
I meet problem when using mysql, and doing the migration. I think the script should be changed at the beginning script "260dbcc8b680".
024-09-04 16:27:44,552 - migration.py[line:218] - INFO: Will assume non-transactional DDL. 2024-09-04 16:27:44,564 - migration.py[line:623] - INFO: Running upgrade -> 260dbcc8b680, Adds tables [09/04/24 16:27:44] ERROR 2024-09-04 16:27:44 - ERROR
utils utils.py:127
(pymysql.err.OperationalError)
(1170, "BLOB/TEXT column 'description'
used in key specification without a
key length")
[SQL: CREATE INDEX ix_flow_description
ON flow (description)]
(Background on this error at:
https://sqlalche.me/e/20/e3q8)
ERROR 2024-09-04 16:27:44 - ERROR - api_server.py:129
api_server -
(pymysql.err.OperationalError)
(1170, "BLOB/TEXT column
'description' used in key
specification without a key
length")
[SQL: CREATE INDEX
ix_flow_description ON flow
(description)]
(Background on this error at:
https://sqlalche.me/e/20/e3q8)
Then I changed the scirpt and fix the problem. File: /base/langflow/alembic/versions/260dbcc8b680_adds_tables.py
line 103
with op.batch_alter_table("flow", schema=None) as batch_op:
flow_columns = [col["name"] for col in inspector.get_columns("flow")]
if "user_id" not in flow_columns:
batch_op.add_column(
sa.Column(
"user_id",
sqlmodel.sql.sqltypes.GUID(),
nullable=True, # This should be False, but we need to allow NULL values for now
)
)
if "user.id" not in existing_fks_flow:
batch_op.create_foreign_key("fk_flow_user_id", "user", ["user_id"], ["id"])
if "ix_flow_description" not in existing_indices_flow:
# Corrected way to specify key length for the description column index
batch_op.create_index(batch_op.f("ix_flow_description"), [sa.text("description(255)")], unique=False)
if "ix_flow_name" not in existing_indices_flow:
batch_op.create_index(batch_op.f("ix_flow_name"), ["name"], unique=False)
Reproduction
using mysql to start server
Expected behavior
Who can help?
No response
Operating System
macs
Langflow Version
1.0.17
Python Version
3.12
Screenshot
No response
Flow File
No response