river-of-ebooks/migrations/20190224022422_add_admin_us...

30 lines
823 B
JavaScript

exports.up = function (knex, Promise) {
return Promise.all([
knex.schema.table('user', t => {
t.boolean('admin').defaultTo(false)
}),
knex.schema.createTable('publishkey', t => {
t.increments('id').primary()
t.integer('user').notNullable().references('user.id').onDelete('CASCADE').onUpdate('CASCADE')
t.string('name')
t.string('url')
t.string('appid')
t.string('secret')
t.string('verification_key')
t.boolean('whitelisted').defaultTo(false)
t.boolean('verified').defaultTo(false)
t.bigInteger('created_at')
t.bigInteger('updated_at')
})
])
}
exports.down = function (knex, Promise) {
return Promise.all([
knex.schema.table('user', t => {
t.dropColumns('admin')
}),
knex.schema.dropTable('publishkey')
])
}