diff options
author | Matthew Draper <matthew@trebex.net> | 2015-12-06 06:09:00 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2015-12-15 17:18:09 +1030 |
commit | badaf353ba4591ce78fa0c305b656f7cae56992b (patch) | |
tree | bef58d69726af17a891a71faadc15f6cfc006849 /activerecord/lib/active_record | |
parent | f37d92c41036d4eff168b8a8951a8b8a76baa347 (diff) | |
download | rails-badaf353ba4591ce78fa0c305b656f7cae56992b.tar.gz rails-badaf353ba4591ce78fa0c305b656f7cae56992b.tar.bz2 rails-badaf353ba4591ce78fa0c305b656f7cae56992b.zip |
In 4.2 migrations, `timestamps` defaulted to `null: true`
.. it also showed a deprecation warning, but we obviously needn't retain
that.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/migration/compatibility.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb index 71d702e812..4c8db8a2d5 100644 --- a/activerecord/lib/active_record/migration/compatibility.rb +++ b/activerecord/lib/active_record/migration/compatibility.rb @@ -4,6 +4,30 @@ module ActiveRecord V5_0 = Current module FourTwoShared + module TableDefinition + def timestamps(*, **options) + options[:null] = true if options[:null].nil? + super + end + end + + def create_table(table_name, options = {}) + if block_given? + super(table_name, options) do |t| + class << t + prepend TableDefinition + end + yield t + end + else + super + end + end + + def add_timestamps(*, **options) + options[:null] = true if options[:null].nil? + super + end end class V4_2 < V5_0 |