summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/app.js b/app.js
index ae332d98..ce37032b 100644
--- a/app.js
+++ b/app.js
@@ -264,16 +264,19 @@ function startListen () {
}
// sync db then start listen
-models.sequelize.sync().then(function () {
- // check if realtime is ready
- if (realtime.isReady()) {
- models.Revision.checkAllNotesRevision(function (err, notes) {
- if (err) throw new Error(err)
- if (!notes || notes.length <= 0) return startListen()
- })
- } else {
- throw new Error('server still not ready after db synced')
- }
+models.sequelize.authenticate().then(function () {
+ models.runMigrations().then(() => {
+ sessionStore.sync()
+ // check if realtime is ready
+ if (realtime.isReady()) {
+ models.Revision.checkAllNotesRevision(function (err, notes) {
+ if (err) throw new Error(err)
+ if (!notes || notes.length <= 0) return startListen()
+ })
+ } else {
+ throw new Error('server still not ready after db synced')
+ }
+ })
})
// log uncaught exception