1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Migration can be null

This commit is contained in:
Laurent Cozic
2021-11-03 15:20:17 +00:00
parent 7ad73df170
commit a0d23046bf
2 changed files with 2 additions and 2 deletions

View File

@ -269,7 +269,7 @@ async function main() {
if (config().database.autoMigration) { if (config().database.autoMigration) {
appLogger().info('Auto-migrating database...'); appLogger().info('Auto-migrating database...');
await migrateLatest(ctx.joplinBase.db); await migrateLatest(ctx.joplinBase.db);
appLogger().info('Latest migration:', (await latestMigration(ctx.joplinBase.db)).name); appLogger().info('Latest migration:', await latestMigration(ctx.joplinBase.db));
} else { } else {
appLogger().info('Skipped database auto-migration.'); appLogger().info('Skipped database auto-migration.');
} }

View File

@ -347,7 +347,7 @@ export function isUniqueConstraintError(error: any): boolean {
return false; return false;
} }
export async function latestMigration(db: DbConnection): Promise<Migration> { export async function latestMigration(db: DbConnection): Promise<Migration | null> {
try { try {
const result = await db('knex_migrations').select('name').orderBy('id', 'desc').first(); const result = await db('knex_migrations').select('name').orderBy('id', 'desc').first();
return { name: result.name, done: true }; return { name: result.name, done: true };