I posted the question over on stackoverflow, but basically I can’t figure out how to run a schema migration as a different postgres user. I have upgraded to the latest rails so that I can use the primary database connection and I’ve also configured another connection which is using a postgres superuser to connect, but I can’t seem to run the migration using that alternative connection.
If your database connections are defined in config/database.yml
you can run your migrations against the desired database by specifying the environment for which it is defined, e.g.
RAILS_ENV=production rails db:migrate
You can create as many custom environments as you like.