🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

[Bug][Devlake DB Migration] DB Migration failure on PostgreSQL due to MODIFY syntax in migration 20250320_modify_file_meta.go #8564

Closed

Description

@jcg-juan

Search before asking

  • 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:

  1. Use PostgreSQL as the DevLake database.
  2. Run DevLake v1.0.2 or later (ensure image version is v1.0.2).
  3. 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.

Version

v1.0.2+

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    type/bug
    on Sep 4, 2025
  2. added
    component/plugins
    severity/p0
    on Sep 4, 2025
  3. dosubot commented on Sep 4, 2025

    @dosubot

    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.

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about incubator-devlake Share Dosu with your team

  4. GoSimplicity commented on Sep 5, 2025

    @GoSimplicity
    Contributor

    Search before asking

    • 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:

    1. Use PostgreSQL as the DevLake database.
    2. Run DevLake v1.0.2 or later (ensure image version is v1.0.2).
    3. 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.

    Version

    v1.0.2+

    Are you willing to submit PR?

    • Yes I am willing to submit a PR!

    Code of Conduct

    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.

  5. klesh commented on Sep 5, 2025

    @klesh
    Contributor
  6. github-actions commented on Nov 5, 2025

    @github-actions
    Contributor

    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.

  7. github-actions commented on Nov 13, 2025

    @github-actions
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalecomponent/pluginsseverity/p0type/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions