Describe the bug
DB migration fails:
aused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Script V95__add_source_points_table.sql failed
reitti-1 | ----------------------------------------------
reitti-1 | SQL State : 23505
reitti-1 | Error Code : 0
reitti-1 | Message : ERROR: could not create unique index "idx_raw_source_upsert_target"
reitti-1 | Detail: Key (user_id, "timestamp", device_id)=(2, 2026-05-06 21:33:31+00, null) is duplicated.
reitti-1 | Location : db/migration/V95__add_source_points_table.sql (/app/nested:/app/app.jar/!BOOT-INF/classes/!/db/migration/V95__add_source_points_table.sql)
reitti-1 | Line : 17
reitti-1 | Statement : Run Flyway with -X option to see the actual statement causing the problem
reitti-1 |
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:256) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:217) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:137) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:75) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:66) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:31) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:65) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:391) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | ... 102 common frames omitted
reitti-1 | Caused by: org.postgresql.util.PSQLException: ERROR: could not create unique index "idx_raw_source_upsert_target"
reitti-1 | Detail: Key (user_id, "timestamp", device_id)=(2, 2026-05-06 21:33:31+00, null) is duplicated.
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2904) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2589) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:431) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:534) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:437) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:359) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:344) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:320) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:315) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-6.3.3.jar!/:na]
reitti-1 | at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-6.3.3.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:215) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:88) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:212) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | ... 108 common frames omitted
reitti-1 |
reitti-1 | DATA_DIR (/data) is already writable. Skipping chown.
To Reproduce
Steps to reproduce the behavior:
Follow instructions on migrating from 4 to 5
Update tags from :next to 5
run sql command
pull and start containers
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Linux reitti 6.17.9-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.9-1 (2026-01-12T16:25Z) x86_64 GNU/Linux
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Describe the bug
DB migration fails:
aused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: Script V95__add_source_points_table.sql failed
reitti-1 | ----------------------------------------------
reitti-1 | SQL State : 23505
reitti-1 | Error Code : 0
reitti-1 | Message : ERROR: could not create unique index "idx_raw_source_upsert_target"
reitti-1 | Detail: Key (user_id, "timestamp", device_id)=(2, 2026-05-06 21:33:31+00, null) is duplicated.
reitti-1 | Location : db/migration/V95__add_source_points_table.sql (/app/nested:/app/app.jar/!BOOT-INF/classes/!/db/migration/V95__add_source_points_table.sql)
reitti-1 | Line : 17
reitti-1 | Statement : Run Flyway with -X option to see the actual statement causing the problem
reitti-1 |
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:256) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:217) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:137) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:75) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:66) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:31) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:65) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:391) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | ... 102 common frames omitted
reitti-1 | Caused by: org.postgresql.util.PSQLException: ERROR: could not create unique index "idx_raw_source_upsert_target"
reitti-1 | Detail: Key (user_id, "timestamp", device_id)=(2, 2026-05-06 21:33:31+00, null) is duplicated.
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2904) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2589) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:431) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:534) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:437) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:359) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:344) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:320) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:315) ~[postgresql-42.7.11.jar!/:42.7.11]
reitti-1 | at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95) ~[HikariCP-6.3.3.jar!/:na]
reitti-1 | at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java) ~[HikariCP-6.3.3.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:215) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:88) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | at org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:212) ~[flyway-core-11.7.2.jar!/:na]
reitti-1 | ... 108 common frames omitted
reitti-1 |
reitti-1 | DATA_DIR (/data) is already writable. Skipping chown.
To Reproduce
Steps to reproduce the behavior:
Follow instructions on migrating from 4 to 5
Update tags from :next to 5
run sql command
pull and start containers
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Linux reitti 6.17.9-1-pve #1 SMP PREEMPT_DYNAMIC PMX 6.17.9-1 (2026-01-12T16:25Z) x86_64 GNU/Linux
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.