Stu Mason
Stu Mason

Activity

Pull Request Opened

PR #32 opened: fix: use dynamic database name in materialized view migration

Problem

ALTER DATABASE CURRENT SET pg_trgm.similarity_threshold = 0.4 is not valid PostgreSQL syntax. Postgres interprets CURRENT as a literal database name, causing:

SQLSTATE[3D000]: Invalid catalog name: 7 ERROR: database "current" does not exist

This fails on every deploy during migration, triggering Coolify's blue/green rollback. The app has been stuck on commit 89f68c0 (pre-cross-platform matching) since Feb 18.

Fix

Use DB::connection()->getDatabaseName() to dynamically resolve the actual database name. Applied to both up() and down() methods.

Tested

  • Confirmed the running container is on stale image (89f68c0)
  • Confirmed the new image (ca7349d) fails with the exact error above
  • Confirmed pg_trgm extension is installed and the laravel user has permissions
+5
additions
-2
deletions
1
files changed