diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts index a6a47235d..e7af47a65 100644 --- a/packages/server/src/app.ts +++ b/packages/server/src/app.ts @@ -5,7 +5,7 @@ import * as Koa from 'koa'; import * as fs from 'fs-extra'; import Logger, { LoggerWrapper, TargetType } from '@joplin/lib/Logger'; import config, { initConfig, runningInDocker } from './config'; -import { migrateLatest, waitForConnection, sqliteDefaultDir } from './db'; +import { migrateLatest, waitForConnection, sqliteDefaultDir, latestMigration } from './db'; import { AppContext, Env, KoaNext } from './utils/types'; import FsDriverNode from '@joplin/lib/fs-driver-node'; import routeHandler from './middleware/routeHandler'; @@ -269,6 +269,7 @@ async function main() { if (config().database.autoMigration) { appLogger().info('Auto-migrating database...'); await migrateLatest(ctx.joplinBase.db); + appLogger().info('Latest migration:', (await latestMigration(ctx.joplinBase.db)).name); } else { appLogger().info('Skipped database auto-migration.'); } diff --git a/packages/server/src/db.ts b/packages/server/src/db.ts index 5cea91648..08ec0265f 100644 --- a/packages/server/src/db.ts +++ b/packages/server/src/db.ts @@ -347,10 +347,10 @@ export function isUniqueConstraintError(error: any): boolean { return false; } -export async function latestMigration(db: DbConnection): Promise { +export async function latestMigration(db: DbConnection): Promise { try { const result = await db('knex_migrations').select('name').orderBy('id', 'desc').first(); - return result; + return { name: result.name, done: true }; } catch (error) { // If the database has never been initialized, we return null, so // for this we need to check the error code, which will be