-
-
Save nfroidure/5696893 to your computer and use it in GitHub Desktop.
This file contains 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
// -------- Database section | |
// current version | |
var __versions__ = ['1.0.1','1.0.2','1.0.3']; | |
var __version__ = localStorage.getItem('db:version') | |
||__versions__[__versions__.length-1]; | |
function migrate_1_0_1() { | |
console.log('going into migrate_1_0_1'); | |
} | |
function migrate_1_0_2() { | |
console.log('going into migrate_1_0_2'); | |
} | |
function migrate_1_0_3() { | |
console.log('going into migrate_1_0_3'); | |
} | |
function migrate() { | |
for(var i=0, j=__versions__.length; i<j; i++) { | |
if(__version__<__versions__[i]) { | |
__version__=__versions__[i]; | |
window['migrate_'+__version__.replace('.','_')](); | |
} | |
} | |
localStorage.setItem('db:version',__version__); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment