title: Yii2 : Add ON UPDATE CURRENT_TIMESTAMP attribute
body: <p>I am extending <code>yii\db\Migration</code> class to add a method <code>timestamps</code> which will speed up me creating migrations. It will add all timestamps I need in every migration I will create.</p>
  
  <p>I have seen this functionality in Laravel and CakePHP frameworks and I'm curious why this is not available by default within Yii 2 Migration Tool.</p>
  
  <p>I have tried the following:</p>
  
  <pre><code>namespace custom\db;
  
  use \yii\db\Migration as YiiMigration;
  
  class Migration extends YiiMigration
  {
      public function timestamps($tableName)
      {
          $this-&gt;addColumn(
              $tableName,
              'created_at',
              $this-&gt;timestamp()-&gt;null()-&gt;defaultExpression('CURRENT_TIMESTAMP')
          );
  
          $this-&gt;addColumn(
              $tableName,
              'updated_at',
              $this-&gt;timestamp()-&gt;null()
          );
  
          $this-&gt;addColumn(
              $tableName,
              'deleted_at',
              $this-&gt;timestamp()-&gt;null()-&gt;defaultExpression('NULL')
          );
      }
  }
  </code></pre>
  
  <p>In my actual migration in <code>up</code> or <code>safeUp</code> method I do the following:</p>
  
  <pre><code>public function safeUp()
  {
      $this-&gt;createTable('test', [
          'id' =&gt; 'pk',
      ]);
  
      $this-&gt;timestamps('test');
  }
  </code></pre>
  
  <p>When I run this, fields <code>created_at</code> and <code>deleted_at</code> get their types and default values as specified. <code>created_at</code> is nullable but it's default value is <code>CURRENT_TIMESTAMP</code> and <code>deleted_at</code> is nullable and it's default value is <code>NULL</code>.</p>
  
  <p>Problem is with <code>updated_at</code> field. I do not know the way to set attributes to that field with Yii 2 migrations and I need to set: <code>ON UPDATE CURRENT_TIMESTAMP</code> attribute, which will always change the value when the record is updated.</p>
  
  <p>Now, this goes even further. When I was testing this functionality only with using <code>created_at</code> field and with following options, that field would always get the attribute <code>ON UPDATE CURRENT_TIMESTAMP</code>:</p>
  
  <pre><code>$this-&gt;addColumn(
      $tableName,
      'created_at',
      $this-&gt;timestamp()
  );
  </code></pre>
  
  <p>And yes, the field is not nullable and it contains the attribute I need. And that still is not what I need because I need the field nullable, followed by that attribute.</p>
  
  <p>And for the end, the worst part...</p>
  
  <p>I have tried doing the following for the <code>updated_at</code>, hoping that it will follow what happend to <code>created_at</code>:</p>
  
  <pre><code>$this-&gt;addColumn(
      $tableName,
      'updated_at',
      $this-&gt;timestamp()
  );
  </code></pre>
  
  <p>Now the default value in the table is: <code>0000-00-00 00:00:00</code> and it's not nullable.</p>
  
  <p>What is happening here, I do not have any clue anymore.</p>
  
  <p>What am I doing wrong here and how to do this right?</p>