Merge pull request #354 from resin-io/353-deviceconfig-populate

If there's no entries in deviceConfig table, always create one.
This commit is contained in:
Pablo Carranza Vélez 2016-12-20 14:18:43 -03:00 committed by GitHub
commit e7388d6338

View File

@ -28,8 +28,10 @@ knex.init = Promise.all([
knex.schema.createTable 'deviceConfig', (t) ->
t.json('values')
t.json('targetValues')
.then ->
knex('deviceConfig').insert({ values: '{}', targetValues: '{}' })
.then ->
knex('deviceConfig').select()
.then (deviceConfigs) ->
knex('deviceConfig').insert({ values: '{}', targetValues: '{}' }) if deviceConfigs.length == 0
knex.schema.hasTable('app')
.then (exists) ->