From 0ea30bc49b2979a21ceea2edfd77d8d4ea1811f5 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 18 Jul 2023 15:09:31 +0200 Subject: [PATCH] :technologist: Exit prisma command if database url starts with "postgres://" Closes #602 --- packages/prisma/scripts/executeCommand.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/prisma/scripts/executeCommand.ts b/packages/prisma/scripts/executeCommand.ts index f0be4a775..c91288423 100644 --- a/packages/prisma/scripts/executeCommand.ts +++ b/packages/prisma/scripts/executeCommand.ts @@ -26,7 +26,7 @@ export const executePrismaCommand = (command: string, options?: Options) => { if (!databaseUrl) { console.error('Could not find DATABASE_URL in environment') - return + process.exit(1) } if (databaseUrl?.startsWith('mysql://')) { @@ -38,6 +38,11 @@ export const executePrismaCommand = (command: string, options?: Options) => { console.log('Executing for PostgreSQL schema') executeCommand(`${command} --schema ${postgesqlSchemaPath}`) } + + if (process.env.DATABASE_URL?.startsWith('postgres://')) { + console.error('PostgreSQL `DATABASE_URL` should start with postgresql://') + process.exit(1) + } } const executeCommand = (command: string) => {