mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Fix error applying device configuration because deviceConfig table is empty
If there's no entries in deviceConfig table, always create one. Avoids problems if the supervisor is stopped while running the db initialization (deviceConfig gets created but not populated). Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
7006f58267
commit
c67977cbed
@ -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) ->
|
||||
|
Loading…
Reference in New Issue
Block a user