IndexedDB Examples updated for Firefox 11 - onupgradeneeded method

The latest editor's draft of IndexedDB has been revised with changes to manage versions of the database better using the onupgradeneeded method.
The onupgradeneeded method seems so obvious in hindsight and it is a great way to manage database versions, providing migration paths. Like traditional databases, the schema of IndexedDB would change over time with requirements to create additional stores and indexes. However, unlike traditional databases, these databases are distributed may not be able to follow a simple, single step upgrade path.
For example
  • Some users would have a version of 1, and return to the website when the version is upgraded to 2, and then to 3, etc. 
  • There may also be users who were on version 1, but would return to the website when the latest version is 7. The IndexedDB for such users would have to be guided through a migration path that runs the steps for upgrade in each version. 
The onupgrademethod callback will simply have migration code for all versions of IndexedDB, making database migration easier. You can take a look at the examples here -

The onupgradeneededmethod is supported in Firefox 11.0a Aurora. It is still not available in Google Chrome 18.0.1025.2 canary yet.