mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
Add routines automation workflows
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
7a652b8998
commit
8f5196f7d6
35 changed files with 25977 additions and 5 deletions
|
|
@ -670,7 +670,18 @@ export async function applyPendingMigrations(url: string): Promise<void> {
|
|||
await sql.end();
|
||||
}
|
||||
|
||||
const bootstrappedState = await inspectMigrations(url);
|
||||
let bootstrappedState = await inspectMigrations(url);
|
||||
if (bootstrappedState.status === "upToDate") return;
|
||||
if (bootstrappedState.reason === "pending-migrations") {
|
||||
const repair = await reconcilePendingMigrationHistory(url);
|
||||
if (repair.repairedMigrations.length > 0) {
|
||||
bootstrappedState = await inspectMigrations(url);
|
||||
}
|
||||
if (bootstrappedState.status === "needsMigrations" && bootstrappedState.reason === "pending-migrations") {
|
||||
await applyPendingMigrationsManually(url, bootstrappedState.pendingMigrations);
|
||||
bootstrappedState = await inspectMigrations(url);
|
||||
}
|
||||
}
|
||||
if (bootstrappedState.status === "upToDate") return;
|
||||
throw new Error(
|
||||
`Failed to bootstrap migrations: ${bootstrappedState.pendingMigrations.join(", ")}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue