Prisma "P1003: Database does not exist" in CI
P1003 means the server is reachable and the credentials are valid, but the specific database named in your connection string has not been created. Prisma will not implicitly create it for migrate deploy.
What this error means
Prisma fails with "P1003: Database app does not exist on the database server at localhost:5432", usually because the service created a different default database.
Error: P1003: Database `app` does not exist on the database server at `localhost:5432`.Common causes
The service created a different default database
The Postgres container created postgres (or a POSTGRES_DB value) but DATABASE_URL points at a database name that was never created.
The database name in the URL is wrong
A typo or environment mismatch names a database that does not exist on this server.
How to fix it
Create the database in the service
Set POSTGRES_DB (or an init step) so the named database exists before Prisma runs.
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: app
POSTGRES_PASSWORD: postgresPoint the URL at an existing database
Match the database name in DATABASE_URL to one the server actually has.
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgresHow to prevent it
- Create the target database via the service env before Prisma runs.
- Keep the database name in the URL aligned with the service config.
- Use one connection string source across the workflow.