$ n8n
Initializing n8n process n8n ready on ::, port 5678 Migrations in progress, please do NOT stop the process. Starting migration AddMockedNodesColumnToTestDefinition1733133775640 Migration “AddMockedNodesColumnToTestDefinition1733133775640” failed, error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘[]’) NOT NULL’ at line 1 There was an error running database migrations You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(‘[]’) NOT NULL’ at line 1
关键错误:
near ‘(‘[]’) NOT NULL’ at line 1
也就是说迁移语句中出现了类似这样的内容:
ALTER TABLE test_definition ADD COLUMN mockedNodes (‘[]’) NOT NULL;
或
ADD COLUMN mockedNodes JSON(‘[]’) NOT NULL;
这在 MariaDB/MySQL 中是非法的语法。
背景原因:
n8n 最近几个版本(特别是 >= 1.64)开始正式使用 PostgreSQL JSONB 类型,并且迁移脚本默认假设你使用的是 PostgreSQL。
虽然 n8n 理论上支持 MySQL/MariaDB,但其最新迁移中对 JSON 默认值 (DEFAULT ‘[]’) 的语法处理并不兼容 MariaDB。