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.

  1. Let connection be transaction’s connection.

  2. Let database be connection’s database.

  3. 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.

  4. 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.

  5. For each object store handle handle associated with transaction, including those for object stores that were created or deleted during transaction:

    1. If handle’s object store was not newly created during transaction, set handle’s name to its object store‘s name.

    2. Set handle’s index set to the set of indexes that reference its object store.

  1. This reverts the values of `[name](#dom-idbobjectstore-name)` and `[indexNames](#dom-idbobjectstore-indexnames)` returned by related `[IDBObjectStore](#idbobjectstore)` objects.
  2. 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.
  1. For each index handle handle associated with transaction, including those for indexes that were created or deleted during transaction:

    1. If handle’s index was not newly created during transaction, set handle’s name to its index‘s name.
  1. This reverts the value of `[name](#dom-idbindex-name)` returned by related `[IDBIndex](#idbindex)` objects.
  2. 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.