mysqlでtimestamp型を使って更新日時と作成日時の両方を記録

mysqlでtimestamp型を使って更新日時と作成日時の両方を記録したい
———————————————-
created timestamp NOT NULL default ‘0000-00-00 00:00:00’,
modified timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
———————————————-

mysql> INSERT INTO test ( name , create_date ) VALUES ( ‘foo’ , NULL );
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+—-+——+———————+———————+
| id | name | create_date | modified_date |
+—-+——+———————+———————+
| 1 | foo | 2010-01-26 15:27:59 | 2010-01-26 15:27:59 |
+—-+——+———————+———————+
1 row in set (0.00 sec)

———————————————

———-テスト用のテーブル—————–
CREATE TABLE `test` (
id int(4) unsigned NOT NULL auto_increment,
name varchar(10) ,
create_date timestamp NOT NULL default ‘0000-00-00 00:00:00’,
modified_date timestamp NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);

mysql> desc test;
+—————+—————–+——+—–+———————+—————————–+
| Field | Type | Null | Key | Default | Extra |
+—————+—————–+——+—–+———————+—————————–+
| id | int(4) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(10) | YES | | NULL | |
| create_date | timestamp | NO | | 0000-00-00 00:00:00 | |
| modified_date | timestamp | YES | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+—————+—————–+——+—–+———————+—————————–+
4 rows in set (0.00 sec)

————————————

http://www.dbonline.jp/mysql/table/index6.html