I have a custom container, connecting to a dev PostgreSQL database in App Platform. I connect with the ${db.DATABASE_URL} connection string with the provided user/pass.
When my migrations attempt to create tables, I’m presented with “permission denied (SQLSTATE 42501)”.
How might I escalate the supplied user’s privileges, connect as the doadmin user, or otherwise allow my application to run its migrations on a dev database, in App Platform?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
There should be no need to escalate the user privileges in order to create tables.
I have a demo Laravel project that uses a Dev Postgres database and here is how I supply the credentials:
After that the database migrations work as expected.
Can you share how exactly are you utilizing the
${db.DATABASE_URL}
connection string in your code?The
DATABASE_URL
env var, already has the username and the password in there, so there should be no need to specify them again, eg.:UPDATE: The issue was that the dev database permissions will not allow you to create databases or schemas; instead, you will need to use the default database and the public schema.
You will get permissions denied if you were to try and create a new schema, eg:
- Bobby