1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-23 18:04:47 +01:00
umami/scripts/copy-db-schema.js

19 lines
527 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 databaseType = process.env.DATABASE_TYPE || process.env.DATABASE_URL.split(':')[0];
2020-08-21 10:45:44 +02:00
if (!databaseType) {
throw new Error('Database schema not specified');
2020-08-21 10:45:44 +02:00
}
console.log(`Database schema detected: ${databaseType}`);
2020-08-21 11:04:28 +02:00
const src = path.resolve(__dirname, `../prisma/schema.${databaseType}.prisma`);
2020-08-21 10:45:44 +02:00
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}`);