add deploy if missing migrations. add logic to hand 01_init
parent
689091212e
commit
c7476aa59e
|
@ -59,14 +59,19 @@ async function checkMigrations() {
|
||||||
const output = await run('prisma', ['migrate', 'status']);
|
const output = await run('prisma', ['migrate', 'status']);
|
||||||
|
|
||||||
const missingMigrations = output.includes('have not yet been applied');
|
const missingMigrations = output.includes('have not yet been applied');
|
||||||
|
const missingInitialMigration = output.includes('01_init');
|
||||||
const notManaged = output.includes('The current database is not managed');
|
const notManaged = output.includes('The current database is not managed');
|
||||||
|
|
||||||
if (notManaged || missingMigrations) {
|
if (notManaged || missingMigrations) {
|
||||||
console.log('Running update...');
|
console.log('Running update...');
|
||||||
|
|
||||||
|
if (missingInitialMigration) {
|
||||||
console.log(execSync('prisma migrate resolve --applied "01_init"').toString());
|
console.log(execSync('prisma migrate resolve --applied "01_init"').toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(execSync('prisma migrate deploy').toString());
|
||||||
|
}
|
||||||
|
|
||||||
success('Database is up to date.');
|
success('Database is up to date.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue