diff --git a/migrations/20181119152303_timestamps_to_bigint.js b/migrations/20181119152303_timestamps_to_bigint.js index 4aaeac8..45bf937 100644 --- a/migrations/20181119152303_timestamps_to_bigint.js +++ b/migrations/20181119152303_timestamps_to_bigint.js @@ -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() }) ]) }