LanguageGB
Databases

Connect your app to PostgreSQL

Put the connection string into your app and confirm it can read and write.

What this means

What this means

Your app connects with a DATABASE_URL, the standard PostgreSQL connection string. Inside CM Cloud it goes through a connection pooler, which is what keeps the database usable as your app scales and redeploys.

Before you start

Before you start

Have the database created, and know where your framework reads environment variables from.

Step-by-step guidance

Step-by-step guidance

  1. In the Connection tab, select Show connection details.
  2. Copy DATABASE_URL exactly — it already contains the host, port, user, password and database name.
  3. Add it to your app's environment in the portal, then redeploy.
  4. Run your migrations.
  5. Open the Tables tab in the console to confirm the tables exist and hold rows.

What CM Cloud support will review

What CM Cloud support will review

Support can check that the variable is present in the running app and that the database is reachable from your runtime node.

What is not automated yet

What is not automated yet

Because connections go through a pooler in transaction mode, LISTEN/NOTIFY, session advisory locks, and SET statements that must persist across statements do not work. Normal queries, transactions and migrations are unaffected. If your app needs those features, tell support before you build on them.

Safety note

Safety note

The console connects as a read-only login, so looking at your data through it cannot change it. Your application keeps its own login, which can write.

Safe next action

Safe next action

Set DATABASE_URL in your app's environment, redeploy, and confirm a write from your app shows up in the Tables tab.

Contact Support