title: Adding creation time, modification time column to existing table in mysql
body: <p>I have a table with some records. Now I want to add 'created' and 'updated' columns to it. I am using queries like this</p>
  
  <pre><code>ALTER TABLE employee ADD COLUMN updated TIMESTAMP NOT NULL DEFAULT 
      CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
  </code></pre>
  
  <p>But this is creating columns with value as all zeros. I want it to be current timestamp.</p>
  
  <p>Sample:</p>
  
  <pre><code>mysql&gt; select * from employee;  
  +----+------+  
  | id | name |  
  +----+------+  
  |  1 | a    |  
  |  2 | b    |  
  |  3 | c    |  
  +----+------+  
  3 rows in set (0.00 sec)  
  
  mysql&gt; alter table employee add column updated timestamp not null default current_timestamp on update current_timestamp;  
  Query OK, 3 rows affected (0.20 sec)  
  Records: 3  Duplicates: 0  Warnings: 0  
  
  mysql&gt; select * from employee;  
  +----+------+---------------------+  
  | id | name | updated             |  
  +----+------+---------------------+  
  |  1 | a    | 0000-00-00 00:00:00 |  
  |  2 | b    | 0000-00-00 00:00:00 |  
  |  3 | c    | 0000-00-00 00:00:00 |  
  +----+------+---------------------+  
  3 rows in set (0.00 sec)  
  
  mysql&gt; update employee set name='aa' where id='1';  
  Query OK, 1 row affected (0.05 sec)  
  Rows matched: 1  Changed: 1  Warnings: 0  
  
  mysql&gt; select * from employee;  
  +----+------+---------------------+  
  | id | name | updated             |  
  +----+------+---------------------+  
  |  1 | aa   | 2015-12-10 15:41:44 |  
  |  2 | b    | 0000-00-00 00:00:00 |  
  |  3 | c    | 0000-00-00 00:00:00 |  
  +----+------+---------------------+  
  3 rows in set (0.00 sec)  
  
  mysql&gt; alter table employee add column city varchar(10) not null default 'banglore';  
  Query OK, 3 rows affected (0.17 sec)  
  Records: 3  Duplicates: 0  Warnings: 0  
  
  mysql&gt; select * from employee;  
  +----+------+---------------------+----------+  
  | id | name | updated             | city     |  
  +----+------+---------------------+----------+  
  |  1 | aa   | 2015-12-10 15:41:44 | banglore |  
  |  2 | b    | 0000-00-00 00:00:00 | banglore |  
  |  3 | c    | 0000-00-00 00:00:00 | banglore |  
  +----+------+---------------------+----------+  
  3 rows in set (0.00 sec)
  </code></pre>
  
  <p>Seems like DEFAULT CURRENT_TIMESTAMP is not working  </p>