Open xzqxnet0990 opened 2 months ago
To fix the issue with the "description" field in MySQL during migration in the script 260dbcc8b680
, you need to specify a key length for the description
column when creating the index. This is necessary because MySQL requires a length for indexing TEXT
columns.
Here is the corrected part of the script:
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)
This change ensures that the description
column is indexed with a specified length, which is required by MySQL for TEXT
columns [1].
To continue talking to Dosu, mention @dosu.
@xzqxnet0990
Based on what you wrote here: https://github.com/langflow-ai/langflow/pull/3431
Are you going to create a PR for the fix?
@xzqxnet0990
Based on what you wrote here: #3431
Are you going to create a PR for the fix?
I already do it, see #3679
@xzqxnet0990
I am just checking if you have any updates on #3679?
Bug Description
I meet problem when using mysql, and doing the migration. I think the script should be changed at the beginning script "260dbcc8b680".
Then I changed the scirpt and fix the problem. File: /base/langflow/alembic/versions/260dbcc8b680_adds_tables.py
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