Schema integrity check improvements
- Create userdata tables and indexes that are missing - Delete tables and triggers that should no longer exist - Run schema integrity check before user data migration - Run schema integrity check after restart error This is meant to address two problems: 1) Database damage, and subsequent use of the DB Repair Tool, that results in missing tables 2) A small number of cases of schema update steps somehow not being reflected in users' databases despite their having updated userdata numbers, which are set within the same transaction. Until we figure out how that's happening, we should start adding conditional versions of schema update steps to the integrity check. This is currently only running the update check after a restart error, which might not occur for all missed schema update steps, so we might want other triggers for calling setIntegrityCheckRequired().
This commit is contained in:
parent
6bcc8af86b
commit
5b9e6497af
5 changed files with 155 additions and 43 deletions
|
@ -248,6 +248,14 @@ describe("Zotero.Schema", function() {
|
|||
});
|
||||
})
|
||||
|
||||
it("should repair a missing userdata table", async function () {
|
||||
await Zotero.DB.queryAsync("DROP TABLE retractedItems");
|
||||
assert.isFalse(await Zotero.DB.tableExists('retractedItems'));
|
||||
assert.isFalse(await Zotero.Schema.integrityCheck());
|
||||
assert.isTrue(await Zotero.Schema.integrityCheck(true));
|
||||
assert.isTrue(await Zotero.DB.tableExists('retractedItems'));
|
||||
});
|
||||
|
||||
it("should repair a foreign key violation", function* () {
|
||||
yield assert.eventually.isTrue(Zotero.Schema.integrityCheck());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue