1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +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) {
appLogger().info('Auto-migrating database...');
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 {
appLogger().info('Skipped database auto-migration.');
}

View File

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