Migration Bug: DrizzleQueryError: Failed query: ALTER TABLE "agents" ALTER COLUMN "title" SET DATA TYPE varchar(255); #9496
-
📦 PlatformSelf hosting Docker 📦 Deploymenet modeserver db(lobe-chat-database image) 📌 Version1.133.2 💻 Operating SystemOther Linux 🌐 BrowserSafari 🐛 Bug DescriptionHello! I've experienced a bug when updating to 1.133.2 version I'm building self image with some branding.ts changes with Docker from Dockerfile.database file. PostgreSQL database version: 16 After several times I've got a solution for fixing those migrations: But before I've run manually:
📷 Recurrence StepsNo response 🚦 Expected BehaviorNo response 📝 Additional InformationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
👀 @Ar4ikov Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @Ar4ikov! I'm Dosu and I’m helping the lobe-chat team. The migration error happens because existing data in the Recent migration scripts have adjusted these truncation lengths (for example, truncating Best practice: always back up your database before truncating or migrating, and use SQL queries to count and review affected records before making changes. Once all values fit the new limits, the migration should complete without errors. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
You are right. And we do the same thing in the improve agent field sql |
Beta Was this translation helpful? Give feedback.
Hi @Ar4ikov! I'm Dosu and I’m helping the lobe-chat team.
The migration error happens because existing data in the
agents.titlecolumn exceeds the newvarchar(255)limit, so PostgreSQL blocks the schema change until all values fit the constraint. Your workaround—truncating values withUPDATE agents SET title = LEFT(title, 255) WHERE LENGTH(title) > 255;—is the recommended solution and matches both official migration scripts and community guidance for Lobe Chat. This approach is also used for other columns, likedescription, when their length limits change [source 1] [source 2].Recent migration scripts have adjusted these truncation lengths (for example, truncating
titleto 200 anddescr…