Issue #402: Ensure that app configs are non-null and valid json objects

This prevents duplicated containers when updating from older supervisors before the config column
was introduced.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2017-03-22 20:49:27 -03:00
parent 64fc60bf77
commit 147abe8a76

View File

@ -52,6 +52,9 @@ knex.init = Promise.all([
addColumn('app', 'appId', 'string')
addColumn('app', 'config', 'json')
]
.then ->
# When updating from older supervisors, config can be null
knex('app').update({ config: '{}' }).whereNull('config')
knex.schema.hasTable('image')
.then (exists) ->