alter tables with alterTable

pull/31/head
unknown 2018-11-19 15:31:44 -05:00
parent 098f8f6b11
commit 0109bfd3c0
1 changed files with 24 additions and 32 deletions

View File

@ -1,49 +1,41 @@
exports.up = function (knex, Promise) {
return Promise.all([
knex.schema.table('user', t => {
t.dropColumns('created_at', 'updated_at')
t.bigInteger('created_at')
t.bigInteger('updated_at')
knex.schema.alterTable('user', t => {
t.bigInteger('created_at').alter()
t.bigInteger('updated_at').alter()
}),
knex.schema.table('passport', t => {
t.dropColumns('created_at', 'updated_at')
t.bigInteger('created_at')
t.bigInteger('updated_at')
knex.schema.alterTable('passport', t => {
t.bigInteger('created_at').alter()
t.bigInteger('updated_at').alter()
}),
knex.schema.table('targeturl', t => {
t.dropColumns('created_at', 'updated_at')
t.bigInteger('created_at')
t.bigInteger('updated_at')
knex.schema.alterTable('targeturl', t => {
t.bigInteger('created_at').alter()
t.bigInteger('updated_at').alter()
}),
knex.schema.table('book', t => {
t.dropColumns('created_at', 'updated_at')
t.bigInteger('created_at')
t.bigInteger('updated_at')
knex.schema.alterTable('book', t => {
t.bigInteger('created_at').alter()
t.bigInteger('updated_at').alter()
})
])
}
exports.down = function (knex, Promise) {
return Promise.all([
knex.schema.table('user', t => {
t.dropColumns('created_at', 'updated_at')
t.integer('created_at')
t.integer('updated_at')
knex.schema.alterTable('user', t => {
t.integer('created_at').alter()
t.integer('updated_at').alter()
}),
knex.schema.table('passport', t => {
t.dropColumns('created_at', 'updated_at')
t.integer('created_at')
t.integer('updated_at')
knex.schema.alterTable('passport', t => {
t.integer('created_at').alter()
t.integer('updated_at').alter()
}),
knex.schema.table('targeturl', t => {
t.dropColumns('created_at', 'updated_at')
t.integer('created_at')
t.integer('updated_at')
knex.schema.alterTable('targeturl', t => {
t.integer('created_at').alter()
t.integer('updated_at').alter()
}),
knex.schema.table('book', t => {
t.dropColumns('created_at', 'updated_at')
t.integer('created_at')
t.integer('updated_at')
knex.schema.alterTable('book', t => {
t.integer('created_at').alter()
t.integer('updated_at').alter()
})
])
}