riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.37k stars 89 forks source link

migration library: specify schema without search path DSN? #603

Open nexovec opened 1 day ago

nexovec commented 1 day ago

Hi, is it possible to make migrate do its migration inside a postgres schema and then connect to it with a client without actually spawning an entire new pgxpool(with search_path in the DSN string)?

bgentry commented 1 day ago

Search path is currently the only way for the migrator to execute migrations against an alternate schema. I think to do otherwise we would probably need to evolve some sort of string interpolation for schema into our migrations. Might be something we tackle when trying to solve alternate schemas more broadly (there are still a number of other compatibility issues mostly stemming from sqlc not offering a way to inject a schema name dynamically).