From c0eb1746dbf0c9ec813301f9abfcfceb04a4b552 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 11 Oct 2006 09:44:20 +0000 Subject: [PATCH] Turn on auto-vacuuming, which keeps file size down after deletes and prevents DB fragmentation This can't be enabled on databases with existing tables, so for existing users we can either a) add a FAQ with instructions to recreate and let the advanced users do it and let everyone else have larger tables or b) add a migration step to dump to a new file and then replace the old with the new, which may be a risky and not all that easy proposition (given the lack of .dump) but might work... The steps, by the way, with Firefox closed: $ sqlite3 zotero.sqlite sqlite> .out dump.sql sqlite> .quit $ sqlite3 db.sqlite sqlite> PRAGMA auto_vacuum = 1; sqlite> .read dump.sql sqlite> .quit $ mv db.sqlite zotero.sqlite --- chrome/content/zotero/xpcom/schema.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index c7025e0ba..012705c18 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -311,6 +311,9 @@ Zotero.Schema = new function(){ function _initializeSchema(){ Zotero.DB.beginTransaction(); try { + // Enable auto-vacuuming + Zotero.DB.query("PRAGMA auto_vacuum = 1"); + Zotero.DB.query(_getSchemaSQL('userdata')); _updateDBVersion('userdata', _getSchemaSQLVersion('userdata'));