You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][Devlake DB Migration] DB Migration failure on PostgreSQL due to MODIFY syntax in migration 20250320_modify_file_meta.go #8564
I had searched in the issues and found no similar issues.
What happened
Starting from v1.0.2 (and still present in latest), DevLake fails to start when using PostgreSQL because the migration plugins/q_dev/models/migrationscripts/20250320_modify_file_meta.go runs a MySQL-specific ALTER TABLE ... MODIFY statement.
This causes the DB migration process to panic immediately on startup, blocking usage of the app.
What do you expect to happen
Expected Behavior:
DB migrations should succeed on PostgreSQL (as supported in prior versions like v1.0.2-beta8).
How to reproduce
Steps to Reproduce:
Use PostgreSQL as the DevLake database.
Run DevLake v1.0.2 or later (ensure image version is v1.0.2).
Observe the startup migration step.
Expected Behaviour:
DB migrations should succeed on PostgreSQL (as supported in prior versions like v1.0.2-beta8).
Actual Behaviour (Error Log):
ERROR: syntax error at or near "MODIFY" (SQLSTATE 42601)
failed to modify processed_time column
panic recovered:
github.com/apache/incubator-devlake/plugins/q_dev/models/migrationscripts.(*modifyFileMetaTable).Up
/app/plugins/q_dev/models/migrationscripts/20250320_modify_file_meta.go:38
Anything else
Root Cause:
The migration contains this SQL: sql := "ALTER TABLE _tool_q_dev_s3_file_meta MODIFY processed_time DATETIME NULL"
MODIFY is MySQL/MariaDB-specific and not valid PostgreSQL syntax.
DATETIME is also a MySQL type; PostgreSQL uses TIMESTAMP.
This breaks PostgreSQL migrations and blocks DevLake startup.
Environment:
DevLake: v1.0.2+
Database: PostgreSQL (fails)
Last known working: v1.0.2-beta8
Impact:
Blocks DB migration process on PostgreSQL → prevents DevLake from starting.
Hi @jcg-juan! I'm Dosu and I’m helping the incubator-devlake team.
The migration failure is caused by MySQL-specific SQL in 20250320_modify_file_meta.go, which uses ALTER TABLE ... MODIFY and DATETIME—these are not valid in PostgreSQL. The script does not include any logic to handle different SQL dialects, so PostgreSQL migrations will fail on DevLake v1.0.2+ as you described. There are currently no fixes, workarounds, or open PRs addressing this issue in the repository, and the migration script has not been updated for PostgreSQL compatibility as of the latest commit source.
To resolve this, migration scripts should detect the database dialect and run compatible SQL for each engine (for example, use ALTER TABLE ... ALTER COLUMN ... TYPE TIMESTAMP for PostgreSQL). The DevLake DAL interface supports dialect detection, but it's not used in this migration. Until the script is updated, PostgreSQL support for this migration remains broken.
I had searched in the issues and found no similar issues.
What happened
Starting from v1.0.2 (and still present in latest), DevLake fails to start when using PostgreSQL because the migration plugins/q_dev/models/migrationscripts/20250320_modify_file_meta.go runs a MySQL-specific ALTER TABLE ... MODIFY statement.
This causes the DB migration process to panic immediately on startup, blocking usage of the app.
What do you expect to happen
Expected Behavior: DB migrations should succeed on PostgreSQL (as supported in prior versions like v1.0.2-beta8).
How to reproduce
Steps to Reproduce:
Use PostgreSQL as the DevLake database.
Run DevLake v1.0.2 or later (ensure image version is v1.0.2).
Observe the startup migration step.
Expected Behaviour: DB migrations should succeed on PostgreSQL (as supported in prior versions like v1.0.2-beta8).
Actual Behaviour (Error Log):
ERROR: syntax error at or near "MODIFY" (SQLSTATE 42601)
failed to modify processed_time column
panic recovered:
github.com/apache/incubator-devlake/plugins/q_dev/models/migrationscripts.(*modifyFileMetaTable).Up
/app/plugins/q_dev/models/migrationscripts/20250320_modify_file_meta.go:38
Anything else
Root Cause: The migration contains this SQL: sql := "ALTER TABLE _tool_q_dev_s3_file_meta MODIFY processed_time DATETIME NULL"
MODIFY is MySQL/MariaDB-specific and not valid PostgreSQL syntax.
DATETIME is also a MySQL type; PostgreSQL uses TIMESTAMP.
This breaks PostgreSQL migrations and blocks DevLake startup.
Environment:
DevLake: v1.0.2+
Database: PostgreSQL (fails)
Last known working: v1.0.2-beta8
Impact: Blocks DB migration process on PostgreSQL → prevents DevLake from starting.
I resolved the compatibility issue of the PostgreSQL migration by replacing the MySQL-specific syntax with the SQL that supports the dialect and adding idempotency checks. The PR has been submitted.
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
Activity
dosubot commentedon Sep 4, 2025
Hi @jcg-juan! I'm Dosu and I’m helping the incubator-devlake team.
The migration failure is caused by MySQL-specific SQL in
20250320_modify_file_meta.go, which usesALTER TABLE ... MODIFYandDATETIME—these are not valid in PostgreSQL. The script does not include any logic to handle different SQL dialects, so PostgreSQL migrations will fail on DevLake v1.0.2+ as you described. There are currently no fixes, workarounds, or open PRs addressing this issue in the repository, and the migration script has not been updated for PostgreSQL compatibility as of the latest commit source.To resolve this, migration scripts should detect the database dialect and run compatible SQL for each engine (for example, use
ALTER TABLE ... ALTER COLUMN ... TYPE TIMESTAMPfor PostgreSQL). The DevLake DAL interface supports dialect detection, but it's not used in this migration. Until the script is updated, PostgreSQL support for this migration remains broken.To reply, just mention @dosu.
Docs are dead. Just use Dosu.
GoSimplicity commentedon Sep 5, 2025
I resolved the compatibility issue of the PostgreSQL migration by replacing the MySQL-specific syntax with the SQL that supports the dialect and adding idempotency checks. The PR has been submitted.
klesh commentedon Sep 5, 2025
Loop @warren830
github-actions commentedon Nov 5, 2025
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
github-actions commentedon Nov 13, 2025
This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.