From db077e8090623801721d574263c57b2641698e7e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 2 Jan 2019 10:07:04 +0900 Subject: Allow using Action Mailbox on MySQL 5.5 Active Record still support MySQL 5.5 which doesn't support datetime with precision. https://github.com/rails/rails/blob/9e34df00039d63b5672315419e76f06f80ef3dc4/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L99-L101 So we should check `supports_datetime_with_precision?` on the connection. --- .../db/migrate/20180917164000_create_action_mailbox_tables.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'actionmailbox/db') diff --git a/actionmailbox/db/migrate/20180917164000_create_action_mailbox_tables.rb b/actionmailbox/db/migrate/20180917164000_create_action_mailbox_tables.rb index 550cc0e4e5..89ab66c1a9 100644 --- a/actionmailbox/db/migrate/20180917164000_create_action_mailbox_tables.rb +++ b/actionmailbox/db/migrate/20180917164000_create_action_mailbox_tables.rb @@ -5,8 +5,11 @@ class CreateActionMailboxTables < ActiveRecord::Migration[6.0] t.string :message_id, null: false t.string :message_checksum, null: false - t.datetime :created_at, precision: 6, null: false - t.datetime :updated_at, precision: 6, null: false + if supports_datetime_with_precision? + t.timestamps precision: 6 + else + t.timestamps + end t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true end -- cgit v1.2.3