NeonN
Neon2y ago
12 replies
generous-coffee

Setting the default database on Vercel

Hi there 👋

We've integrated our project that is deployed on Vercel with Neon and I'm trying to achieve the following:

- Have a database for the "Production" environment in Vercel (eg. my-app-production)
- Have a separate database (that contains different data) for every other preview on Vercel.

The Production environment on Vercel is deployed via a production environment and we have a next branch that is our main branch (all our PRs get merged into it) which we base off all our preview branches of.

What I've tried so far is the following:
- Created the two databases
- Migrated data to each database, I've got the my-app-production and my-app-development databases fully set up.
- Went to Integrations > Added > Vercel > Manage > Settings and tried to set the my-app-development database as the default under "Default database and Role".
- Saw that all environmnent variables that were set by Neon had switched to the my-app-development database.
- Created a new git branch locally eg. fotis/test-12345
- Pushed the branch on GitHub which triggers a new Vercel deployment and the environment variable generation.
- Saw that the environment variables for new deployments still get created with the original database (my-app-production).

Is there perhaps a bug in the Vercel integration? Is there any way I can achieve the above?

Thank you 🙏
Was this page helpful?