Multiple DBs in a project
This issue was created almost 5 years ago and is still open. Competitors such as Drizzle support it, so if there's not a plan to add this functionality, I'll have to start migrating my project.
The solution recommended in the ticket doesn't work cleanly with migrations, is there a way to specifiy where migrations live? or specify in the build which migrations directory to run for each database?
Thank you!
https://github.com/prisma/prisma/issues/2443#issuecomment-630679118
GitHub
Multiple Connections / Databases / Datasources · Issue #2443 · pris...
Problem An application may need to access different connections/databases. One use case could be having the exact same set of tables into different databases (multi-tenant approach). Another use ca...
5 Replies
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into
#ask-ai
if you get antsy for a second opinion!HI @Jpo
There is currently no built-in way in Prisma to specify a custom location for migrations or to specify different migration directories for multiple databases in a single project. The recommended approach in the isssue you linked is to create separate schema files for each database and keep migrations in separate directories.
As per our plans to add this functionality, we do not have an ETA at the moment but you can see how we intend managing issues in our manifesto moving forward.
GitHub
Prisma ORM Manifesto: Clarity and Collaboration · prisma prisma · D...
Today we published the Prisma ORM Manifesto to mark the start of a new chapter for Prisma. As the project has grown, it’s become increasingly challenging to maintain the repo, stay connected with o...
Yes
For that
|Prisma
|-schema1
|----------shema1.shema
|-shema2
|----------shema2.shema
|----------Migration
|-------------------initialMig
|---------------------mig.sql
Like that above
what would the
prisma migrate dev|deploy
commands be to specify schema?dotenv -e .env.supabasedev -- npx prisma migrate dev --schema prisma/db1-schema/db1-schema.prisma --create-only
add in packge.json script and then only it will run perfectly.......
migrate:'-- npx prisma migrate deploy --schema prisma/schema.prisma'
in packge.json add
npm run migrate
like this