timestamps with precision for Knex + Postgres migrations
const {
addTimestamps, // (knex, table, precision = 3) : Promise
addFunctionOnUpdateTimestamp, // (knex) : Promise
dropFunctionOnUpdateTimestamp // (knex) : Promise
} = require('./knex-pg-timestamps.js');
exports.up = async knex => {
await addFunctionOnUpdateTimestamp(knex);
await knex.schema.createTable('users', t => {
addTimestamps(knex, t);
// ...
})
};
exports.down = async knex => {
await dropFunctionOnUpdateTimestamp(knex);
// ...
};