- db
- The database.
- oldVersion
- The old database version.
- newVersion
- The new database version.
Called when the database needs to be upgraded. The implementation should use this method to drop tables, add tables, or do anything else it needs to upgrade to the new schema version.
The SQLite ALTER TABLE documentation can be found . If you add new columns you can use ALTER TABLE to insert them into a live table. If you rename or remove columns you can use ALTER TABLE to rename the old table, then create the new table and then populate the new table with the contents of the old table.
This method executes within a transaction. If an exception is thrown, all changes will automatically be rolled back.