title: Errors with IndexedDB versions and Dexie.js
body: <p>I´m starting with IndexedDB and to not reinvent the wheel I´m using Dexie.js <a href="https://github.com/dfahlander/Dexie.js" rel="noreferrer">https://github.com/dfahlander/Dexie.js</a></p>
  
  <p>I created the database, I added data and now I´m creating a generic function that get a CSV and populate the database in anothers tables.</p>
  
  <p>So, more or less my code is</p>
  
  <pre><code>// Creation and populate database and first table
  var db = new Dexie("database");
  db.version(1).stores({table1: '++id, name'});
  
  db.table1.add({name: 'hello'});
  </code></pre>
  
  <p>Until here all is OK</p>
  
  <p>Now, in success of ajax request</p>
  
  <pre><code>db.close();
  db.version(2).stores({table2: '++id, name'});
  db.open();
  
  db.table2.add({name: 'hello'});
  </code></pre>
  
  <p>First time this code run everything is OK, but next time I get this error</p>
  
  <pre><code>VersionError The operation failed because the stored database is a 
  higher version than the version requested.
  </code></pre>
  
  <p>If I delete database and run code again only first time works OK.</p>
  
  <p>Any idea? I don´t like too much IndexedDB version way, it´s looks frustrating and I don't get lot of help in the Net
  Thanks.</p>
  
  <p>Edit:
  I discover the ¿problem/bug/procedure?. If I don´t add nothing before any version modification I haven't this issue, but does somebody know if is this the normal procedure?</p>
  
  <p>So.. if this is the procedure I can't add any table dinamycally with a generic method. First all declarations and then add values. Any possibility to add a table after add values?</p>
  
  <p>Edit again... I just realized that I could create another database. I'll post results. But any information about this issue is welcome :)</p>
  
  <p>Edit again... I created dinamycally another database and everybody is happy!!</p>