umami/scripts/copy-db-schema.js

19 lines
444 B
JavaScript
Raw Normal View History

2020-08-21 10:45:44 +02:00
require('dotenv').config();
const fs = require('fs');
const path = require('path');
const db = process.env.DATABASE_URL.split(':')[0];
if (!db) {
throw new Error('Database not specified');
}
2020-08-21 11:04:28 +02:00
console.log(`Database detected: ${db}`);
2020-08-21 10:45:44 +02:00
const src = path.resolve(__dirname, `../prisma/schema.${db}.prisma`);
const dest = path.resolve(__dirname, '../prisma/schema.prisma');
fs.copyFileSync(src, dest);
2020-08-21 11:04:28 +02:00
console.log(`Copied ${src} to ${dest}`);