Use FTS5 optimizer in production
This commit is contained in:
parent
f5c18cfb51
commit
e124730cb0
12 changed files with 200 additions and 42 deletions
|
@ -17,37 +17,7 @@ export function updateToSchemaVersion940(
|
|||
}
|
||||
|
||||
db.transaction(() => {
|
||||
const wasEnabled =
|
||||
db
|
||||
.prepare(
|
||||
`
|
||||
SELECT v FROM messages_fts_config WHERE k is 'secure-delete';
|
||||
`
|
||||
)
|
||||
.pluck()
|
||||
.get() === 1;
|
||||
|
||||
if (wasEnabled) {
|
||||
logger.info('updateToSchemaVersion940: rebuilding fts5 index');
|
||||
db.exec(`
|
||||
--- Disable 'secure-delete'
|
||||
INSERT INTO messages_fts
|
||||
(messages_fts, rank)
|
||||
VALUES
|
||||
('secure-delete', 0);
|
||||
|
||||
--- Rebuild the index to fix the corruption
|
||||
INSERT INTO messages_fts
|
||||
(messages_fts)
|
||||
VALUES
|
||||
('rebuild');
|
||||
`);
|
||||
} else {
|
||||
logger.info(
|
||||
'updateToSchemaVersion940: secure delete was not enabled, skipping'
|
||||
);
|
||||
}
|
||||
|
||||
// This was a migration that disabled secure-delete and rebuilt the index
|
||||
db.pragma('user_version = 940');
|
||||
})();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue