summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/migration/test_current_from_v72.js
blob: 626279fce4b66c2a1fe8b29a3821b3220f274f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

add_task(async function setup() {
  await setupPlacesDatabase("places_v72.sqlite");
});

add_task(async function database_is_valid() {
  // Accessing the database for the first time triggers migration.
  Assert.equal(
    PlacesUtils.history.databaseStatus,
    PlacesUtils.history.DATABASE_STATUS_UPGRADED
  );

  const db = await PlacesUtils.promiseDBConnection();
  Assert.equal(await db.getSchemaVersion(), CURRENT_SCHEMA_VERSION);

  await db.execute(
    "SELECT recalc_frecency, alt_frecency, recalc_alt_frecency FROM moz_origins"
  );

  await db.execute("SELECT alt_frecency, recalc_alt_frecency FROM moz_places");
  Assert.ok(
    await db.indexExists("moz_places_altfrecencyindex"),
    "Should have created an index"
  );
});