2
0

💚 Fix docker build prisma generate script

This commit is contained in:
Baptiste Arnaud
2023-02-09 15:32:23 +01:00
parent caf54321ec
commit c9fda1518f
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,3 @@
import { executePrismaCommand } from './executeCommand' import { executePrismaCommand } from './executeCommand'
executePrismaCommand('prisma generate') executePrismaCommand('prisma generate', { force: true })

View File

@ -9,8 +9,13 @@ require('dotenv').config({
const postgesqlSchemaPath = join(__dirname, '../postgresql/schema.prisma') const postgesqlSchemaPath = join(__dirname, '../postgresql/schema.prisma')
const mysqlSchemaPath = join(__dirname, '../mysql/schema.prisma') const mysqlSchemaPath = join(__dirname, '../mysql/schema.prisma')
export const executePrismaCommand = (command: string) => { type Options = {
const databaseUrl = process.env.DATABASE_URL force?: boolean
}
export const executePrismaCommand = (command: string, options?: Options) => {
const databaseUrl =
process.env.DATABASE_URL ?? (options?.force ? 'postgresql://' : undefined)
if (!databaseUrl) { if (!databaseUrl) {
console.error('Could not find DATABASE_URL in environment') console.error('Could not find DATABASE_URL in environment')