2
0

🐛 Allow DATABASE_URL starting with "postgres://"

Closes #1259
This commit is contained in:
Baptiste Arnaud
2024-02-19 16:15:26 +01:00
parent ba219b7e59
commit 5879c89ee6

View File

@@ -29,16 +29,19 @@ export const executePrismaCommand = (command: string, options?: Options) => {
executeCommand(`${command} --schema ${mysqlSchemaPath}`) executeCommand(`${command} --schema ${mysqlSchemaPath}`)
} }
if (databaseUrl?.startsWith('postgres')) { if (
databaseUrl?.startsWith('postgres://') ||
databaseUrl?.startsWith('postgresql://')
) {
console.log('Executing for PostgreSQL schema') console.log('Executing for PostgreSQL schema')
executeCommand(`${command} --schema ${postgesqlSchemaPath}`) executeCommand(`${command} --schema ${postgesqlSchemaPath}`)
} }
if (process.env.DATABASE_URL?.startsWith('postgres://')) { console.error(
console.error('PostgreSQL `DATABASE_URL` should start with postgresql://') 'Invalid `DATABASE_URL` format, it should start with `postgresql://` or `postgres://`'
)
process.exit(1) process.exit(1)
} }
}
const executeCommand = (command: string) => { const executeCommand = (command: string) => {
exec(command, (error, stdout, stderr) => { exec(command, (error, stdout, stderr) => {