ngx-indexed-db
ngx-indexed-db copied to clipboard
Unable to delete database because it's blocked
when i call this.dbService.deleteDatabase().subscribe((deleted) => { console.log('Database deleted successfully: ', deleted); });
log in console: ERROR Error: Unable to delete database because it's blocked at deleteDBRequest.onblocked [as __zone_symbol__ON_PROPERTYblocked] (ngx-indexed-db.mjs:531:27)
Hi @EmadR, most likely there is an open connection to that database somewhere.
hi @aparzi how to close all connections?
You generally never need to close a connection. Except if You may wish to explicitly close a connection if you anticipate upgrading your database schema. Here's the scenario:
-
A user opens your site in one tab, and leaves it open.
-
You push an update to your site, which includes code to upgrade the database schema, increasing the version number.
-
The same user opens a second tab to your site and it attempts to connect to the database.
What situation do you have?
I have a panel, when the user logs in, I get information from server and save it in the form of a table in indexeddb. Now, when the same user wants to exit the panel, I delete the database and it gives the error I said
how do you save the information in the database?
const dbConfig: DBConfig = { name: 'MyDb', version: 1, objectStoresMeta: [{ store: 'employee', storeConfig: { keyPath: 'id', autoIncrement: true }, storeSchema: [] }] };
this.dbService .add('employee', response.data) .subscribe((key) => { console.log('key: ', key); });
Okay, I will investigate the issue.
Hi @EmadR, why your storeSchema is empty array? can you add your store schema?
Example: storeSchema: [ { name: 'name', keypath: 'name', options: { unique: false } }, { name: 'email', keypath: 'email', options: { unique: false } }, ]
HI @EmadR, any news?
Must it be set? Because for the update, the response I get may not match the configuration and the keys may be different
What do you mean update?
I may receive new data from the server and have to update my table. This is what I mean by update.
Hi @EmadR, did you solve the problem?
hi @aparzi , no