mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Run migrations on start
This commit is contained in:
parent
0f32f48c24
commit
9ea175eb3f
10 changed files with 40 additions and 199 deletions
|
|
@ -1,5 +1,5 @@
|
|||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
function getDatabase() {
|
||||
|
|
@ -25,6 +25,13 @@ console.log(`Database type detected: ${databaseType}`);
|
|||
const src = path.resolve(__dirname, `../prisma/schema.${databaseType}.prisma`);
|
||||
const dest = path.resolve(__dirname, '../prisma/schema.prisma');
|
||||
|
||||
fs.copyFileSync(src, dest);
|
||||
fse.copyFileSync(src, dest);
|
||||
|
||||
console.log(`Copied ${src} to ${dest}`);
|
||||
|
||||
const srcMigrations = path.resolve(__dirname, `../prisma/${databaseType}/migrations`);
|
||||
const destMigrations = path.resolve(__dirname, `../prisma/migrations`);
|
||||
|
||||
fse.copySync(srcMigrations, destMigrations);
|
||||
|
||||
console.log(`Copied ${srcMigrations} to ${destMigrations}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue