Problem
On a fresh production system, the goose migrator fails on startup with:
ERROR Failed to ensure goose version table
table_name="shared_migration"
error="failed to create goose version table (MID_26033108): failed to create version table \"shared_migration\": pq: no schema has been selected to create in"
This causes the server to exit immediately.
Root Cause
SharedDBHandle connects with search_path=shared, so all tables it creates (including the goose migration tracking table shared_migration) go into the shared schema. However, PostgreSQL only has the public schema by default — if the shared schema doesn't exist yet, any CREATE TABLE on that connection fails with "no schema has been selected to create in".
The schema creation code in createPGDB() was commented out, so the shared schema was never created automatically.
Fix
Added CREATE SCHEMA IF NOT EXISTS shared using the ProjectDBHandle (which connects to public with full permissions) immediately before creating the SharedDBHandle. This is idempotent — safe to run on existing systems where the schema already exists.
Affected File
go/api/ApiUtils/ApiUtils.go — createPGDB() function
Problem
On a fresh production system, the goose migrator fails on startup with:
This causes the server to exit immediately.
Root Cause
SharedDBHandleconnects withsearch_path=shared, so all tables it creates (including the goose migration tracking tableshared_migration) go into thesharedschema. However, PostgreSQL only has thepublicschema by default — if thesharedschema doesn't exist yet, anyCREATE TABLEon that connection fails with "no schema has been selected to create in".The schema creation code in
createPGDB()was commented out, so thesharedschema was never created automatically.Fix
Added
CREATE SCHEMA IF NOT EXISTS sharedusing theProjectDBHandle(which connects topublicwith full permissions) immediately before creating theSharedDBHandle. This is idempotent — safe to run on existing systems where the schema already exists.Affected File
go/api/ApiUtils/ApiUtils.go—createPGDB()function