Skip to content

Instantly share code, notes, and snippets.

@nfroidure
Forked from brunobord/gist:5695039
Last active December 18, 2015 00:29
Show Gist options
  • Save nfroidure/5696893 to your computer and use it in GitHub Desktop.
Save nfroidure/5696893 to your computer and use it in GitHub Desktop.
// -------- 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