You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
505 B

import { config } from 'dotenv';
import path from 'path';
config({ path: '../../.env' });
const tempCwd = process.env.NODE_ENV === 'production'
? path.resolve(process.cwd(), 'packages/drizzle-pkg')
: process.cwd();
let dbUrl = process.env.DATABASE_URL;
if (dbUrl && dbUrl.startsWith('file:')) {
let filePath = dbUrl.slice(5);
if (!path.isAbsolute(filePath)) {
filePath = path.resolve(tempCwd, filePath);
process.env.DATABASE_URL = 'file:' + filePath;
}
}