Skip to content

Postgres migrations fail on a fresh database #381

Open

Description

@JetteBke

What happened

Running a full migration against a brand-new PostgreSQL database, two separate SonarQube plugin migrations fail because they try to DROP a constraint/index that the migration assumes already exists from an earlier step, but doesn't on Postgres:

  1. Migration 20230927145127 ("modify file_metrics_key length")

ERROR: constraint "_tool_sonarqube_file_metrics_pkey" of relation "_tool_sonarqube_file_metrics" does not exist (SQLSTATE 42704) ALTER TABLE _tool_sonarqube_file_metrics DROP CONSTRAINT _tool_sonarqube_file_metrics_pkey

  1. Migration 20260701000000 ("change_issue_code_block_component_type")

ERROR: index "idx__tool_sonarqube_issue_code_blocks_component" does not exist (SQLSTATE 42704) (from DropIndexes("_tool_sonarqube_issue_code_blocks", "idx__tool_sonarqube_issue_code_blocks_component"))

Environment:

  • DevLake version: v1.0.3-beta15
  • Database: PostgreSQL 18
  • Deployment: official Helm chart with external DB_URL

Workaround

We excluded the plugin by mounting an empty directory where the sonarqube plugin would be installed otherwise.

  - name: exclude-sonarqube-plugin
    emptyDir: {}
containers:
  - name: lake
    volumeMounts:
      - name: exclude-sonarqube-plugin
        mountPath: /app/bin/plugins/sonarqube

This is pretty hacky and we are wondering if this could be fixed in the helm-chart. it works fine for using MySQL but we have requirements to use Postgres.

Activity

  1. chenwei791129 commented on Oct 19, 2026

    @chenwei791129
    Contributor

    Hi @JetteBke, thanks for the detailed report!

    Both errors come from the DevLake backend (the SonarQube plugin's migration scripts), not from the Helm chart, so there is nothing to change in the chart itself.

    Please follow apache/devlake#9242. Once it is merged and included in a release, you should be able to drop the workaround that excludes the sonarqube plugin.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions