Guest User

Untitled

a guest
May 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var db = openDatabase("example_db", "", "Example Database", 100000);
  2. // openDatabase(db name, required version (blank string for n/a), human-readable database name, expected size in bytes)
  3.  
  4. db.changeVersion("", "1", function(t){
  5. t.executeSql("create table ...");
  6. });
  7.  
  8. /* Note:
  9. openDatabase actually takes one more (optional) argument -- a callback in case the database was /just/ created, for you to call changeVersion and provide an initial schema. However, since this post is more interested in migrations, and because I don't want the initial migration to be a "special case", I'm pretending like it doesn't exist. It's there if you want it, of course.
  10. */
Add Comment
Please, Sign In to add comment