Skip to content
Source
Sign inSign up
Open History to see the last commit

databaseMigrationLog.ts

14 lines736 Bytes

1// The server logs these around pending migrations; the desktop reads them from its output tail,
2// which keeps only the last few thousand characters, so each progress line also marks a running upgrade.
3export const DATABASE_MIGRATIONS_STARTED_MESSAGE = "Running database migrations";
4export const DATABASE_MIGRATION_PROGRESS_MESSAGE = "Upgrading database";
5export const DATABASE_MIGRATIONS_FINISHED_MESSAGE = "Migrations ran successfully";
6​
7export function isRunningDatabaseMigrations(output: string): boolean {
8 return (
9 Math.max(
10 output.lastIndexOf(DATABASE_MIGRATIONS_STARTED_MESSAGE),
11 output.lastIndexOf(DATABASE_MIGRATION_PROGRESS_MESSAGE),
12 ) > output.lastIndexOf(DATABASE_MIGRATIONS_FINISHED_MESSAGE)
13 );