diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/places/tests/migration/head_migration.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/places/tests/migration/head_migration.js')
-rw-r--r-- | toolkit/components/places/tests/migration/head_migration.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/migration/head_migration.js b/toolkit/components/places/tests/migration/head_migration.js new file mode 100644 index 0000000000..9dce9b34b9 --- /dev/null +++ b/toolkit/components/places/tests/migration/head_migration.js @@ -0,0 +1,47 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Import common head. +{ + /* import-globals-from ../head_common.js */ + let commonFile = do_get_file("../head_common.js", false); + let uri = Services.io.newFileURI(commonFile); + Services.scriptloader.loadSubScript(uri.spec, this); +} + +// Put any other stuff relative to this test folder below. + +const CURRENT_SCHEMA_VERSION = 71; +const FIRST_UPGRADABLE_SCHEMA_VERSION = 43; + +async function assertAnnotationsRemoved(db, expectedAnnos) { + for (let anno of expectedAnnos) { + let rows = await db.execute( + ` + SELECT id FROM moz_anno_attributes + WHERE name = :anno + `, + { anno } + ); + + Assert.equal(rows.length, 0, `${anno} should not exist in the database`); + } +} + +async function assertNoOrphanAnnotations(db) { + let rows = await db.execute(` + SELECT item_id FROM moz_items_annos + WHERE item_id NOT IN (SELECT id from moz_bookmarks) + `); + + Assert.equal(rows.length, 0, `Should have no orphan annotations.`); + + rows = await db.execute(` + SELECT id FROM moz_anno_attributes + WHERE id NOT IN (SELECT id from moz_items_annos) + `); + + Assert.equal(rows.length, 0, `Should have no orphan annotation attributes.`); +} |