How to use the dexie.delete function in dexie

To help you get started, we’ve selected a few dexie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dfahlander / Dexie.js / test / tests-upgrading.js View on Github external
test("Issue #30 - Problem with existing db", (assert) => {
    let done = assert.async();
    if (!supports("compound+multiEntry")) {
        ok(true, "SKIPPED - COMPOUND + MULTIENTRY UNSUPPORTED");
        return done();
    }
    ///<var type="Dexie">
    var db; // Will be used as a migrated version of the db.

    // Start by deleting the db if it exists:
    Dexie.delete("raw-db").then(function () {

        // Create a bare-bone indexedDB database with custom indexes of various kinds.
        return new Dexie.Promise(function (resolve, reject) {
            var indexedDB = Dexie.dependencies.indexedDB;
            var rawdb, req;

            function error(e) {
                if (rawdb) rawdb.close();
                reject(e.target.error);
            }

            req = indexedDB.open("raw-db", 2);
            req.onupgradeneeded = function (ev) {
                try {
                    console.log("onupgradeneeded called");
                    rawdb = req.result;</var>
github dfahlander / Dexie.js / test / tests-upgrading.js View on Github external
// This special treatment in the unit tests may not need to be here if we can work around Dexie issue #1.
            deepEqual(idbNames,
                    expected,
                    "IDB object stores must match expected.");
        }
    }

    function checkTransactionObjectStores(t, expected) {
        // Add baseTables.
        expected = expected.concat(baseTables).sort();
        deepEqual(t.storeNames.slice().sort(),
                  expected,
                  "Transaction stores must match expected.");
    }

    Dexie.delete(DBNAME).then(() => {
        // --------------------------------------------------------------------
        // Test: Empty schema
        db = new Dexie(DBNAME);
        db.version(1).stores({});
        return db.open().then(() => {
            ok(true, "Could create empty database without any schema");
            // Set so add-on tables don't invalidate checks.
            baseNumberOfTables = db.tables.length;
            baseTables = db.tables.map(t => t.name);
        });
    }).then(() => {
        db.close();
        // --------------------------------------------------------------------
        // Test: Adding version.
        db = new Dexie(DBNAME);
        db.version(1).stores({});
github dfahlander / Dexie.js / test / tests-open.js View on Github external
}).then(function(result) {
        equal(result, true, "Should still exist");
        return Dexie.delete("TestDB");
    }).then(function () {
        return Dexie.exists("TestDB");
github dfahlander / Dexie.js / test / tests-upgrading.js View on Github external
}).finally(function () {
        if (db) db.close();
        Dexie.delete("raw-db").then(done);
    });
});
github dfahlander / Dexie.js / test / tests-open.js View on Github external
teardown: function () {
        stop(); Dexie.delete("TestDB").then(start);
    }
});
github DaanBroekhof / JoroDox / app / utils / JdxDatabase.js View on Github external
static async clearAll(project) {
    const task = ForegroundTask.start({taskTitle: 'Delete game data cache:'});
    task.progress(0, 1, 'Truncating databases...');

    this.db = {};
    console.log(this.projectToDbName(project));
    await Dexie.delete(this.projectToDbName(project));

    task.finish();
  }
github wireapp / wire-webapp / src / script / auth / StoreEngineProvider.ts View on Github external
export const provideTemporaryAndNonPersistentEngine = async (storeName: string): Promise =&gt; {
  await Dexie.delete('/sqleet');
  const encryptionKey = await saveRandomEncryptionKey();
  const engine = new SQLeetEngine('/worker/sqleet-worker.js', SQLeetSchemata.getLatest(), encryptionKey);
  await engine.init(storeName);
  return engine;
};
github wireapp / wire-webapp / src / script / main / app.js View on Github external
function doRedirect(signOutReason) {
  let url = `/auth/${location.search}`;
  const isImmediateSignOutReason = App.CONFIG.SIGN_OUT_REASONS.IMMEDIATE.includes(signOutReason);
  if (isImmediateSignOutReason) {
    url = appendParameter(url, `${URLParameter.REASON}=${signOutReason}`);
  }

  const redirectToLogin = signOutReason !== SIGN_OUT_REASON.NOT_SIGNED_IN;
  if (redirectToLogin) {
    url = `${url}#login`;
  }

  Dexie.delete('/sqleet');
  window.location.replace(url);
}
github montagejs / montage / data / service / offline-service.js View on Github external
}).then(function(){
                return Dexie.delete(tempName);
            }).then(function () {
                localStorage.setItem(name + "." + self._is_safari_10_1_upgrade_issue_fixed, true);
github montagejs / montage / data / service / offline-service.js View on Github external
return this._copyDatabase(name, tempName).then(function() {
                return Dexie.delete(name);
            }).then(function(){
                return self._copyDatabase(tempName, name);