Last active
September 29, 2017 06:47
-
-
Save SquirrelMobile/5c3891efcb600250f629f7eb3b0056c4 to your computer and use it in GitHub Desktop.
Handle versioning of your Axway Titanium application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function constructor(){ | |
require('install')(); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class Lib.db | |
* database lib | |
*/ | |
module.exports = Ti.Database.open('databaseName'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class Lib.install | |
* install lib | |
*/ | |
(function(){ | |
var db = require('db'); | |
/** | |
* var _exports - description | |
* | |
* @return {type} description | |
*/ | |
var _exports = function(){ | |
var version = Ti.App.Properties.getInt('versionDatabase'), | |
versionOrigine = version; | |
if(!version){ | |
version = 0; | |
} | |
if(version < 1){ | |
Ti.App.Properties.setBool('isConnected', false); | |
db.execute('CREATE TABLE IF NOT EXISTS variable (id INTEGER PRIMARY KEY AUTOINCREMENT, key_ VARCHAR(255) NOT NULL, value TEXT NULL)'); | |
version = 1; | |
} | |
if(version > versionOrigine){ | |
Ti.App.Properties.setInt('versionDatabase', version); | |
} | |
}; | |
module.exports = _exports; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment