mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-29 18:18:52 +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
@ -29,7 +29,9 @@ knex.init = Promise.all([
|
|||||||
t.json('values')
|
t.json('values')
|
||||||
t.json('targetValues')
|
t.json('targetValues')
|
||||||
.then ->
|
.then ->
|
||||||
knex('deviceConfig').insert({ values: '{}', targetValues: '{}' })
|
knex('deviceConfig').select()
|
||||||
|
.then (deviceConfigs) ->
|
||||||
|
knex('deviceConfig').insert({ values: '{}', targetValues: '{}' }) if deviceConfigs.length == 0
|
||||||
|
|
||||||
knex.schema.hasTable('app')
|
knex.schema.hasTable('app')
|
||||||
.then (exists) ->
|
.then (exists) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user