From e08a2fa86cb92c38a0f80e93b8f55447f7e2ac89 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:07:48 -0800 Subject: [PATCH] Optimize database after running migrations --- ts/sql/migrations/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ts/sql/migrations/index.ts b/ts/sql/migrations/index.ts index 6ac32e9ca19..5519aabe6eb 100644 --- a/ts/sql/migrations/index.ts +++ b/ts/sql/migrations/index.ts @@ -1993,4 +1993,8 @@ export function updateSchema(db: Database, logger: LoggerType): void { runSchemaUpdate(userVersion, db, logger); } + + if (userVersion !== maxUserVersion) { + db.pragma('optimize'); + } }