我已经为 activerecord 创建了带有 created_at 和 updated_at 列的表,以自动填充这些字段。我正在使用带有 mysql2 0.3.13 gem 的 rails 4 和 mariadb 5.5
`created_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000',
`updated_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
但是当我保存一个项目时,精度不是(6)/微秒。它像是
+----------------------------+----------------------------+
| created_at | updated_at |
+----------------------------+----------------------------+
| 2013-10-03 17:31:54.000000 | 2013-10-03 17:31:54.000000 |
| 2013-10-03 17:32:32.000000 | 2013-10-03 17:32:32.000000 |
| 2013-10-03 17:33:29.000000 | 2013-10-03 17:33:29.000000 |
| 2013-10-03 17:35:06.000000 | 2013-10-03 17:35:06.000000 |
| 2013-10-03 18:06:20.000000 | 2013-10-03 18:06:20.000000 |
+----------------------------+----------------------------+
如何强制 activerecord 使用微秒精度?