migrate
migrate copied to clipboard
Setting DATABASE_OWNER on a supabase database
Summary
When using graphile-migrate with supabase, it uses the wrong DATABASE_OWNER.
Supabase has a url that looks like this
postgresql://[user].[projectId]:[password]@aws-0-us-west-1.pooler.supabase.com:6543/[db-name]
So the :DATABASE_OWNER variable is set to [user].[projectId] instead of [user]
Steps to reproduce
- Create a supabase project
- Create a database, user and password in the supabase url (default is postgres)
- Put the above connection url into a DATABASE_URL environment variable.
- Run graphile-migrate migrate
Expected results
The migration runs.
Actual results
graphile-migrate: Running migration '000001.sql'
error: syntax error at or near "."
The . is from the find and replace of [user].[projectId]
Possible Solution
Give the ability to manually override the :DATABASE_OWNER placeholder.
looks like this is related to https://github.com/graphile/migrate/issues/75 and they propose a reasonable workaround.
What is the username inside the database, is it [user] or is it [user].[projectId]? You can find out via select user;