aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailbox/db
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-01-02 10:07:04 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-01-18 07:04:08 +0900
commitdb077e8090623801721d574263c57b2641698e7e (patch)
tree2597280fdb6775d8394e046b76117b0d2ebf54d9 /actionmailbox/db
parentcc0dd1d371868fe34fba6b58d22a8ba0714d8ae7 (diff)
downloadrails-db077e8090623801721d574263c57b2641698e7e.tar.gz
rails-db077e8090623801721d574263c57b2641698e7e.tar.bz2
rails-db077e8090623801721d574263c57b2641698e7e.zip
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.
Diffstat (limited to 'actionmailbox/db')
-rw-r--r--actionmailbox/db/migrate/20180917164000_create_action_mailbox_tables.rb7
1 files changed, 5 insertions, 2 deletions
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