An instance of a Version class can only be returned from the Dexie.version() method. Use it to define the schema and any upgrader function for that specific version.
Sample
var db =newDexie("FriendsAndPetsDatabase");db.version(2).stores({ friends:"++id,name,birthdate,sex", pets:"++id,name,kind"}).upgrade (trans => {varYEAR=365*24*60*60*1000;returntrans.friends.toCollection().modify (friend => {friend.birthdate =newDate(Date.now() - (friend.age *YEAR));deletefriend.age; });});// Always keep the declarations previous versions as long as there might be users having them running.db.version(1).stores({ friends:"++id,name,age,sex", pets:"++id,name,kind"});db.open();