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` --- activerecord/test/cases/ar_schema_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activerecord/test/cases/ar_schema_test.rb') diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb index 8e796a6f13..98af75e8ca 100644 --- a/activerecord/test/cases/ar_schema_test.rb +++ b/activerecord/test/cases/ar_schema_test.rb @@ -133,6 +133,21 @@ class ActiveRecordSchemaTest < ActiveRecord::TestCase assert @connection.column_exists?(:has_timestamps, :updated_at, null: false) end + if ActiveRecord::Base.connection.supports_bulk_alter? + def test_timestamps_without_null_set_null_to_false_on_change_table_with_bulk + ActiveRecord::Schema.define do + create_table :has_timestamps + + change_table :has_timestamps, bulk: true do |t| + t.timestamps default: Time.now + end + end + + assert @connection.column_exists?(:has_timestamps, :created_at, null: false) + assert @connection.column_exists?(:has_timestamps, :updated_at, null: false) + end + end + def test_timestamps_without_null_set_null_to_false_on_add_timestamps ActiveRecord::Schema.define do create_table :has_timestamps -- cgit v1.2.3