Skip to content

[Bug] PostgreSQL migration fails on restart: idx_reviews_user_date already exists #136

Closed

Description

@mbeq

Version: v0.7.2

When using PostgreSQL and restarting the server, the migration fails with: failed to initialize database: failed to execute schema file system_postgres.sql: pq: relation "idx_reviews_user_date" already exists.

In system_postgres.sql, the index idx_reviews_user_date is created without IF NOT EXISTS. All other indexes in the same file use CREATE INDEX IF NOT EXISTS. This makes the server impossible to restart when using PostgreSQL.

FIX: CREATE INDEX IF NOT EXISTS idx_reviews_user_date ON reviews(user_id, review_date);

Activity

  1. stefan-ernst commented on Jul 5, 2026

    @stefan-ernst
    Contributor

    Hi, I think I spotted the root cause for this: Just to confirm, are you using a postgresql schema other than "public"?

  2. mbeq commented on Jul 7, 2026

    @mbeq
    Author
  3. stefan-ernst commented on Jul 9, 2026

    @stefan-ernst
    Contributor

    Thanks! I will push a new release next week - in the meantime, you can use the :main tag if you use docker

  4. stefan-ernst commented on Jul 21, 2026

    @stefan-ernst
    Contributor

    0.8.2 is finally out. This should solve the migration issue. Let me know if it works

  5. mvkotowski commented on Oct 15, 2026

    @mvkotowski

    For those of you like me that had this same issue, for some reason when you map to a directory make sure to map to

    volumes:
    - /location/onyour/drive:/var/lib/postgresql/

    not /var/lib/postgresql/data

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

    fixed-0.8.2Fix or feature shipped in v0.8.2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions