Search code examples
mysqlruby-on-railspaper-trail-gem

Is MySQL fractional second support necessary when using PaperTrail?


The CreateVersions migration provided by PaperTrail says

MySQL users should manually add fractional seconds precision to this migration

And also says that the experimental association tracking feature requires fractional seconds in the README.

Is this actually necessary for the library to function properly? I would assume that if fractional seconds were not permitted, that data would simply be lost and the timestamp would have the nearest whole second.


Solution

  • PT currently depends on fractional seconds precision (in all tables, not just versions) for two things, that I know of:

    1. the touch_with_version method
    2. the experimental association tracking feature

    I'm pretty sure we can rewrite touch_with_version to remove this dependency, not at all sure about association tracking.

    Thankfully, modern versions of MySQL now come with fractional seconds precision, so you can just upgrade! (trollface)