I\'m trying to insert data in my indexed db, but the function onupgradeneed never is called, just onsuccess. The version of the database is always the same (it is a global v
you can change version 1 for two, it worked for me like this:
let openRequest = window.indexedDB.open ("MyTestDatabase", 2);
Stop using a global db variable, even if some examples show it. It just leads to problems for newer programmers. Try reviewing my answer at How to get objectstore from indexedDB? for help.
Change your dbversion variable to 2. This way the db will open in a newer version and the onupgradeneeded callback will get called