import BaseSchema from 'sosise-core/build/Database/BaseSchema'; /** * For more information, refer to: http://knexjs.org/#Schema */ export default class %name% extends BaseSchema { protected tableName = 'table_name_comes_here'; /** * Run the migrations. */ public async up(): Promise { await this.dbConnection.schema.createTable(this.tableName, (table) => { table.increments('id'); // table.timestamps(true); table.timestamp('created_at').notNullable().defaultTo(this.dbConnection.fn.now()); table.timestamp('updated_at').notNullable().defaultTo(this.dbConnection.raw(`CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP`)); }); } /** * Reverse the migrations. */ public async down(): Promise { await this.dbConnection.schema.dropTable(this.tableName); } }