mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Updated to prisma 3.15.2. Updated check-db script.
This commit is contained in:
parent
c246b88329
commit
89fb62a50a
3 changed files with 31 additions and 25 deletions
|
|
@ -5,6 +5,11 @@ const chalk = require('chalk');
|
|||
const spawn = require('cross-spawn');
|
||||
|
||||
let message = '';
|
||||
const updateMessage = `To update your database, you need to run:\n${chalk.bold.whiteBright(
|
||||
'yarn update-db',
|
||||
)}`;
|
||||
const baselineMessage = cmd =>
|
||||
`You need to update your database by running:\n${chalk.bold.whiteBright(cmd)}`;
|
||||
|
||||
function success(msg) {
|
||||
console.log(chalk.greenBright(`✓ ${msg}`));
|
||||
|
|
@ -34,9 +39,8 @@ async function checkTables() {
|
|||
|
||||
success('Database tables found.');
|
||||
} catch (e) {
|
||||
message = `To update your database, you need to run:\n${chalk.bold.whiteBright(
|
||||
'yarn update-db',
|
||||
)}`;
|
||||
message = updateMessage;
|
||||
|
||||
throw new Error('Database tables not found.');
|
||||
}
|
||||
}
|
||||
|
|
@ -65,10 +69,12 @@ async function checkMigrations() {
|
|||
if (notManaged) {
|
||||
const cmd = output.match(/yarn prisma migrate resolve --applied ".*"/g);
|
||||
|
||||
message = `You need to update your database by running:\n${chalk.bold.whiteBright(cmd[0])}`;
|
||||
message = baselineMessage(cmd[0]);
|
||||
|
||||
throw new Error('Database is out of date.');
|
||||
} else if (missingMigrations) {
|
||||
message = output;
|
||||
message = updateMessage;
|
||||
|
||||
throw new Error('Database is out of date.');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue