Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions packages/cli/src/actions/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ async function runPush(options: Options) {

try {
// run prisma db push
const cmd = `prisma db push --schema "${prismaSchemaFile}"${
options.acceptDataLoss ? ' --accept-data-loss' : ''
}${options.forceReset ? ' --force-reset' : ''} --skip-generate`;
const cmd = [
'prisma db push',
` --schema "${prismaSchemaFile}"`,
options.acceptDataLoss && ' --accept-data-loss',
options.forceReset && ' --force-reset',
' --skip-generate',
].join('');

try {
await execPackage(cmd, {
stdio: 'inherit',
});
await execPackage(cmd);
} catch (err) {
handleSubProcessError(err);
}
Expand Down
34 changes: 22 additions & 12 deletions packages/cli/src/actions/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,42 @@ export async function run(command: string, options: CommonOptions) {

async function runDev(prismaSchemaFile: string, options: DevOptions) {
try {
await execPackage(
`prisma migrate dev --schema "${prismaSchemaFile}" --skip-generate${options.name ? ` --name ${options.name}` : ''}${options.createOnly ? ' --create-only' : ''}`,
{
stdio: 'inherit',
},
);
const cmd = [
'prisma migrate dev',
` --schema "${prismaSchemaFile}"`,
' --skip-generate',
options.name && ` --name ${options.name}`,
options.createOnly && ' --create-only',
].join('');

await execPackage(cmd);
} catch (err) {
handleSubProcessError(err);
}
}

async function runReset(prismaSchemaFile: string, options: ResetOptions) {
try {
await execPackage(`prisma migrate reset --schema "${prismaSchemaFile}"${options.force ? ' --force' : ''}`, {
stdio: 'inherit',
});
const cmd = [
'prisma migrate reset',
` --schema "${prismaSchemaFile}"`,
options.force && ' --force',
].join('');

await execPackage(cmd);
} catch (err) {
handleSubProcessError(err);
}
}

async function runDeploy(prismaSchemaFile: string, _options: DeployOptions) {
try {
await execPackage(`prisma migrate deploy --schema "${prismaSchemaFile}"`, {
stdio: 'inherit',
});
const cmd = [
'prisma migrate deploy',
` --schema "${prismaSchemaFile}"`,
].join('');

await execPackage(cmd);
} catch (err) {
handleSubProcessError(err);
}
Expand Down