5.8. Aborting an upgrade transaction
The steps to abort an upgrade transaction with transaction are as follows.
These steps are run as needed by the steps to abort a transaction, which revert changes to the database including the set of associated object stores and indexes, as well as the change to the version.
Let connection be transaction’s connection.
Let database be connection’s database.
Set connection’s version to database’s version if database previously existed, or 0 (zero) if database was newly created.
This reverts the value of
[version](#dom-idbdatabase-version)
returned by the[IDBDatabase](#idbdatabase)
object.Set connection’s object store set to the set of object stores in database if database previously existed, or the empty set if database was newly created.
This reverts the value of
[objectStoreNames](#dom-idbdatabase-objectstorenames)
returned by the[IDBDatabase](#idbdatabase)
object.For each object store handle handle associated with transaction, including those for object stores that were created or deleted during transaction:
If handle’s object store was not newly created during transaction, set handle’s name to its object store‘s name.
Set handle’s index set to the set of indexes that reference its object store.
This reverts the values of `[name](#dom-idbobjectstore-name)` and `[indexNames](#dom-idbobjectstore-indexnames)` returned by related `[IDBObjectStore](#idbobjectstore)` objects.
How is this observable? Although script cannot access an [object store](#object-store) by using the `[objectStore()](#dom-idbtransaction-objectstore)` method on an `[IDBTransaction](#idbtransaction)` instance after the [transaction](#transaction-concept) is aborted, it can still have references to `[IDBObjectStore](#idbobjectstore)` instances where the `[name](#dom-idbobjectstore-name)` and `[indexNames](#dom-idbobjectstore-indexnames)` properties can be queried.
For each index handle handle associated with transaction, including those for indexes that were created or deleted during transaction:
This reverts the value of `[name](#dom-idbindex-name)` returned by related `[IDBIndex](#idbindex)` objects.
How is this observable? Although script cannot access an [index](#index-concept) by using the `[index()](#dom-idbobjectstore-index)` method on an `[IDBObjectStore](#idbobjectstore)` instance after the [transaction](#transaction-concept) is aborted, it can still have references to `[IDBIndex](#idbindex)` instances where the `[name](#dom-idbindex-name)` property can be queried.
The [name](#dom-idbdatabase-name)
property of the [IDBDatabase](#idbdatabase)
instance is not modified, even if the aborted upgrade transaction was creating a new database.