1

mysql

`modify_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'modify datetime'

javascript

knex.schema.createTable(`record_${today}`,
    function (table) {
        table
            .datetime("modify_at")
            .comment("modify date")
            .notNullable()
            .onUpdate(knex.fn.now());
    }
);

the code run error. it say onUpdate is not a function

ryan
  • 13
  • 2

1 Answers1

0

For this porpoise, you can use timestamps method http://knexjs.org/#Schema-timestamps

Denis Malykhin
  • 349
  • 1
  • 6