Liam Potter
05/06/2021, 9:52 AMnpx prisma db push --preview-feature --force-reset
from the js PrismaClient? I want to use it to clear my database after I run tests.
I suppose I can always use spawn to run the command but if there is a js way to achieve the same thing Iād prefer that.Dominic Hadfield
05/06/2021, 10:08 AMimport { execSync } from 'child_process'
const prismaBinary = join(__dirname, '..', 'node_modules', '.bin', 'prisma')
execSync(`${prismaBinary} migrate deploy --preview-feature`, {
env: {
...process.env,
DATABASE_URL: 'SOME_TEST_URL',
},
})
Liam Potter
05/06/2021, 10:13 AMRobert Witchell
05/06/2021, 10:04 PMexecSync('npm prisma migrate deploy -etc')
or
execSync('yarn prisma migrate deploy -etc')
as .bin/prisma doesn't have the same context as npm/yarn prisma