Skip to content

Postgres migrations fail on a fresh database #381

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.

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