2018-11-19 19:57:48 +00:00
|
|
|
exports.up = function (knex, Promise) {
|
|
|
|
return Promise.all([
|
|
|
|
knex.schema.createTable('user', t => {
|
|
|
|
t.increments('id').primary()
|
|
|
|
t.string('email').notNullable()
|
2019-02-27 01:01:56 +00:00
|
|
|
t.bigInteger('created_at')
|
|
|
|
t.bigInteger('updated_at')
|
2018-11-19 19:57:48 +00:00
|
|
|
}),
|
|
|
|
knex.schema.createTable('passport', t => {
|
|
|
|
t.increments('id').primary()
|
|
|
|
t.string('protocol').notNullable()
|
|
|
|
t.string('password')
|
|
|
|
t.string('accesstoken')
|
|
|
|
t.string('provider')
|
|
|
|
t.string('identifier')
|
|
|
|
t.json('tokens')
|
2018-11-19 20:21:41 +00:00
|
|
|
t.integer('user').notNullable().references('user.id').onDelete('CASCADE').onUpdate('CASCADE')
|
2019-02-27 01:01:56 +00:00
|
|
|
t.bigInteger('created_at')
|
|
|
|
t.bigInteger('updated_at')
|
2018-11-19 19:57:48 +00:00
|
|
|
}),
|
|
|
|
knex.schema.createTable('targeturl', t => {
|
|
|
|
t.increments('id').primary()
|
2018-11-19 20:21:41 +00:00
|
|
|
t.integer('user').notNullable().references('user.id').onDelete('CASCADE').onUpdate('CASCADE')
|
2018-11-19 19:57:48 +00:00
|
|
|
t.string('url')
|
2019-02-27 01:01:56 +00:00
|
|
|
t.bigInteger('created_at')
|
|
|
|
t.bigInteger('updated_at')
|
2018-11-19 19:57:48 +00:00
|
|
|
}),
|
|
|
|
knex.schema.createTable('book', t => {
|
|
|
|
t.increments('id').primary()
|
|
|
|
t.string('source')
|
|
|
|
t.string('storage')
|
|
|
|
t.string('title').notNullable()
|
|
|
|
t.string('author')
|
|
|
|
t.string('version')
|
|
|
|
t.string('isbn')
|
2019-02-27 01:01:56 +00:00
|
|
|
t.bigInteger('created_at')
|
|
|
|
t.bigInteger('updated_at')
|
2018-11-19 19:57:48 +00:00
|
|
|
})
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.down = function (knex, Promise) {
|
|
|
|
return Promise.all([
|
|
|
|
knex.schema.dropTable('book'),
|
|
|
|
knex.schema.dropTable('targeturl'),
|
|
|
|
knex.schema.dropTable('passport'),
|
|
|
|
knex.schema.dropTable('user')
|
|
|
|
])
|
|
|
|
}
|