mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-01 11:36:42 +00:00
29 lines
541 B
CoffeeScript
29 lines
541 B
CoffeeScript
|
Knex = require('knex')
|
||
|
|
||
|
knex = Knex.initialize(
|
||
|
client: 'sqlite3'
|
||
|
connection:
|
||
|
filename: '/supervisor/data/database.sqlite'
|
||
|
)
|
||
|
|
||
|
knex.schema.hasTable('config').then((exists) ->
|
||
|
if not exists
|
||
|
knex.schema.createTable('config', (t) ->
|
||
|
t.increments('id').primary()
|
||
|
t.string('key')
|
||
|
t.string('value')
|
||
|
)
|
||
|
)
|
||
|
|
||
|
knex.schema.hasTable('app').then((exists) ->
|
||
|
if not exists
|
||
|
knex.schema.createTable('app', (t) ->
|
||
|
t.increments('id').primary()
|
||
|
t.string('name')
|
||
|
t.string('imageId')
|
||
|
t.string('status')
|
||
|
)
|
||
|
)
|
||
|
|
||
|
module.exports = knex
|