Created
November 22, 2013 16:57
-
-
Save Meekohi/7603210 to your computer and use it in GitHub Desktop.
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 initDbHashAndFirstRun() { | |
| return when(models.Settings.read('dbHash')).then(function (dbhash) { | |
| // we already ran this, chill | |
| self.dbHash = dbhash.attributes.value; | |
| return dbhash.attributes.value; | |
| }).otherwise(function (error) { | |
| // this is where all the "first run" functionality should go | |
| var dbhash = uuid.v4(); | |
| return when(models.Settings.add({key: 'dbHash', value: dbhash, type: 'core'})).then(function () { | |
| self.dbHash = dbhash; | |
| return dbhash; | |
| }).then(doFirstRun); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment