Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
wait for promise to return
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed Oct 5, 2015
1 parent be7b156 commit 610e34e
Showing 1 changed file with 49 additions and 49 deletions.
98 changes: 49 additions & 49 deletions goddard/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,55 @@ argv = require('minimist')(process.argv.slice(2));
if argv.migrations == true

# run the migrations
app.get('sequelize_instance').sync({})

# should we seed ?
if argv.seed == true
app.get('models').groups.create({

id:1,
name:'Default',
description:'Default group',
key: 'default'

}, null, {validate: false})
.catch(->)
app.get('models').apps.create({

id:1,
name:'Captive Portal',
description:'The default captive portal for the Goddard platform.',
key: 'captiveportal',
slug: 'captive-portal',
visible: false,
portal: true

}, null, {validate: false})
.catch(->)
app.get('models').apps.create({

id:2,
name:'MAMA',
description:'The Mobile Alliance for Maternal Action (MAMA) is a global movement that seeks to use mobile technologies to improve the health and lives of mothers in developing nations.',
key: 'mama',
slug: 'mama',
visible: true,
portal: false

}, null, {validate: false})
.catch(->)
app.get('sequelize_instance')
.query('INSERT INTO installs(id, "groupId", "appId", "createdAt", "updatedAt") VALUES(1,1,1,now(),now())')
.catch(->)
app.get('sequelize_instance')
.query('INSERT INTO installs(id, "groupId", "appId", "createdAt", "updatedAt") VALUES(1,1,2,now(),now())')
.catch(->)

# debug output
console.log('database was synced up')

# done
process.exit(0)
app.get('sequelize_instance').sync({}).then (result, err) ->

# should we seed ?
if argv.seed == true
app.get('models').groups.create({

id:1,
name:'Default',
description:'Default group',
key: 'default'

}, null, {validate: false})
.catch(->)
app.get('models').apps.create({

id:1,
name:'Captive Portal',
description:'The default captive portal for the Goddard platform.',
key: 'captiveportal',
slug: 'captive-portal',
visible: false,
portal: true

}, null, {validate: false})
.catch(->)
app.get('models').apps.create({

id:2,
name:'MAMA',
description:'The Mobile Alliance for Maternal Action (MAMA) is a global movement that seeks to use mobile technologies to improve the health and lives of mothers in developing nations.',
key: 'mama',
slug: 'mama',
visible: true,
portal: false

}, null, {validate: false})
.catch(->)
app.get('sequelize_instance')
.query('INSERT INTO installs(id, "groupId", "appId", "createdAt", "updatedAt") VALUES(1,1,1,now(),now())')
.catch(->)
app.get('sequelize_instance')
.query('INSERT INTO installs(id, "groupId", "appId", "createdAt", "updatedAt") VALUES(1,1,2,now(),now())')
.catch(->)

# debug output
console.log('database was synced up')

# done
process.exit(0)

else

Expand Down

0 comments on commit 610e34e

Please sign in to comment.