title: Knex.JS Auto Update Trigger
body: <p>I am using <a href="http://knexjs.org/" rel="noreferrer">Knex.JS</a> migration tools. However, when creating a table, I'd like to have a column named <code>updated_at</code> that is automatically updated when a record is updated in the database. </p>
  
  <p>For example, here is a table:</p>
  
  <pre><code>knex.schema.createTable('table_name', function(table) {
      table.increments();
      table.string('name');
      table.timestamp("created_at").defaultTo(knex.fn.now());
      table.timestamp("updated_at").defaultTo(knex.fn.now());
      table.timestamp("deleted_at");
  })
  </code></pre>
  
  <p>The <code>created_at</code> and <code>updated_at</code> column defaults to the time the record is created, which is fine. But, when that record is updated, I'd like the <code>updated_at</code> column to show the new time that it was updated at automatically.</p>
  
  <p>I'd prefer not to write in raw postgres.</p>
  
  <p>Thanks!</p>