Re: [w3c/IndexedDB] Initial DB version (when creating db) is 1 in browsers but 0 in spec (#332)

https://w3c.github.io/IndexedDB/#opening


> If |version| is undefined, let |version| be 1 if db is null, or db’s |version| otherwise.

The above makes the default argument 1. Later:

> If |db| is null, let |db| be a new database with name |name|, version 0 (zero), and with no object stores. 

That makes the new database have version 0. Then later:

> Run run an upgrade transaction using |connection|, |version| and |request|.

This starts an upgrade from the initial version (0) to the passed version.

If you check the [IDBVersionChangeEvent](https://w3c.github.io/IndexedDB/#idbversionchangeevent) fired as `upgradeneeded` you will see that for a new database `oldVersion` is 0. Creating a new database is an upgrade from an implicit 0 to the initial version (1, or whatever was specified)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/332#issuecomment-621979579

Received on Thursday, 30 April 2020 17:00:58 UTC