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,15 +29,18 @@ export const executePrismaCommand = (command: string, options?: Options) => {
executeCommand(`${command} --schema ${mysqlSchemaPath}`)
}
if (databaseUrl?.startsWith('postgres')) {
if (
databaseUrl?.startsWith('postgres://') ||
databaseUrl?.startsWith('postgresql://')
) {
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)
}
console.error(
'Invalid `DATABASE_URL` format, it should start with `postgresql://` or `postgres://`'
)
process.exit(1)
}
const executeCommand = (command: string) => {