2
0

🧑‍💻 Exit prisma command if database url starts with "postgres://"

Closes #602
This commit is contained in:
Baptiste Arnaud
2023-07-18 15:09:31 +02:00
parent 13ac46975d
commit 0ea30bc49b

View File

@ -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) => {