diff options
author | Matthew Draper <matthew@trebex.net> | 2017-07-09 02:50:07 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-09 02:50:07 +0930 |
commit | fac5fe09d3f334b8dc3cd800a2fcdc849f9874af (patch) | |
tree | 634246e677483b071a11efb7b17a3e7a9d389dcd /activerecord/lib/active_record/connection_adapters/mysql | |
parent | a41f3305e6c2dfb01921c4dc353670905cc3cee5 (diff) | |
parent | 80cbf27f9e435dbf663e7e517c64d7589f91cc49 (diff) | |
download | rails-fac5fe09d3f334b8dc3cd800a2fcdc849f9874af.tar.gz rails-fac5fe09d3f334b8dc3cd800a2fcdc849f9874af.tar.bz2 rails-fac5fe09d3f334b8dc3cd800a2fcdc849f9874af.zip |
Merge pull request #29708 from kamipo/fix_current_timestamp_for_mariadb
Fix default `CURRENT_TIMESTAMP` in schema dumping for MariaDB 10.2
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/mysql')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb index a01fbba201..24f8ff6367 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_statements.rb @@ -73,8 +73,8 @@ module ActiveRecord def new_column_from_field(table_name, field) type_metadata = fetch_type_metadata(field[:Type], field[:Extra]) - if type_metadata.type == :datetime && field[:Default] == "CURRENT_TIMESTAMP" - default, default_function = nil, field[:Default] + if type_metadata.type == :datetime && /\ACURRENT_TIMESTAMP(?:\(\))?\z/i.match?(field[:Default]) + default, default_function = nil, "CURRENT_TIMESTAMP" else default, default_function = field[:Default], nil end |