I'm planning to create a secondary database for testing purposes. As of now I'm using Prisma's Client to perform CRUD to my secondary database. Good thing it worked fine.
My problem is the migration part. I still need to do it manually. Like editing the schema.prisma file, change the database url, and run prisma migrate dev manually.
I already browsed to Prisma's github, but I can't find an exact solution. I would like to ask here, maybe someone has an idea on how to achieve it.
Working code below.
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient({
  datasources: {
    db: {
      url: 'postgresql://capstone:capstone@postgres:5432/blogpost_test?schema=public'
    }
  }
})
export default prisma
I expect something like below, in which we can just migrate the database programmatically??
prisma.$migrate or prisma.migrate()
                This is not directly supported by Prisma. There is an open feature request that you could +1 here.
Best workaround for now would be to writes scripts that use the CLI commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With