tezvyn:

IndexedDB Versioning: The 'upgradeneeded' Gatekeeper

Source: developer.mozilla.orgadvanced

IndexedDB uses a version number to manage schema changes. Incrementing the version in `indexedDB.open()` triggers a special `upgradeneeded` event, which is the only context where you can create or modify object stores and indexes.

IndexedDB uses a version number to manage schema changes, not just to track versions. Incrementing this number in `indexedDB.open()` triggers a special `upgradeneeded` event, which provides the only context where you can create or modify object stores and indexes. The biggest footgun is trying to alter the schema outside this specific handler; it will always fail.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

IndexedDB Versioning: The 'upgradeneeded' Gatekeeper · Tezvyn