From 5fe6d3747efd37d7d8c6c9d6557d7b623e0398e8 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 26 Jan 2019 20:56:10 +0900 Subject: Fix `t.timestamps` missing `null: false` in `change_table bulk: true` --- .../active_record/connection_adapters/postgresql/schema_statements.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 7cf371be68..9c44cf46aa 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -716,6 +716,8 @@ module ActiveRecord end def add_timestamps_for_alter(table_name, options = {}) + options[:null] = false if options[:null].nil? + [add_column_for_alter(table_name, :created_at, :datetime, options), add_column_for_alter(table_name, :updated_at, :datetime, options)] end -- cgit v1.2.3