Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.db = openDatabase(databaseName, "", displayName);
- Mojo.Log.info("Database version", this.db.version);
- debugObject(this.db);
- if (this.db.version === "0.2") {
- var updateSQL = ["ALTER TABLE notes ADD COLUMN syncnum",
- "ALTER TABLE notes ADD COLUMN version",
- "ALTER TABLE notes ADD COLUMN minversion",
- "ALTER TABLE notes ADD COLUMN sharekey",
- "ALTER TABLE notes ADD COLUMN publishkey",
- "ALTER TABLE notes ADD COLUMN tags",
- "ALTER TABLE notes ADD COLUMN systemtags"
- ];
- this.updateOldVersion(this.db, this.db.version, updateSQL, inCallback);
- }
- this.updateOldVersion = function (database, oldVersion, sqlString, inCallback) {
- Mojo.Log.info ("Entering updateOldVersion in DB to version", version);
- database.changeVersion (oldVersion, version,
- function(transaction){
- Mojo.Log.info("Transaction executeSql", sqlString);
- transaction.executeSql (sqlString,
- function(){
- Mojo.Log.info("success! updating DB");
- },
- function(){
- Mojo.Log.info("FAILURE! updating DB");
- }
- );
- },
- function(error){
- Mojo.Log.info("Too bad!", database.version);
- Mojo.Log.info("error %j", error);
- },
- function () {
- Mojo.log.info("Success from chnageVersion");
- //this.init(inCallback) // success handler
- }
- );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement