diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-06-13 15:55:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-13 15:55:40 -0400 |
commit | 326914dd3a15e04851c9ef4a47edeb3dad2ec381 (patch) | |
tree | 0477cbf2a4aca57e42ec13eaea4576961682df43 /activerecord | |
parent | db7398f79f4dc30cefd6310b538073ec4a2574cc (diff) | |
parent | d9230792ba474d0ff644cc3dc4a3975879bb049c (diff) | |
download | rails-326914dd3a15e04851c9ef4a47edeb3dad2ec381.tar.gz rails-326914dd3a15e04851c9ef4a47edeb3dad2ec381.tar.bz2 rails-326914dd3a15e04851c9ef4a47edeb3dad2ec381.zip |
Merge pull request #29438 from koic/add_migration_compatibility_test
Add test for backward compatibility when using change_table
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/migration/compatibility_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration/compatibility_test.rb b/activerecord/test/cases/migration/compatibility_test.rb index 7a80bfb899..596a21dcbc 100644 --- a/activerecord/test/cases/migration/compatibility_test.rb +++ b/activerecord/test/cases/migration/compatibility_test.rb @@ -90,6 +90,21 @@ module ActiveRecord connection.drop_table :more_testings rescue nil end + def test_timestamps_have_null_constraints_if_not_present_in_migration_of_change_table + migration = Class.new(ActiveRecord::Migration[4.2]) { + def migrate(x) + change_table :testings do |t| + t.timestamps + end + end + }.new + + ActiveRecord::Migrator.new(:up, [migration]).migrate + + assert connection.columns(:testings).find { |c| c.name == "created_at" }.null + assert connection.columns(:testings).find { |c| c.name == "updated_at" }.null + end + def test_timestamps_have_null_constraints_if_not_present_in_migration_for_adding_timestamps_to_existing_table migration = Class.new(ActiveRecord::Migration[4.2]) { def migrate(x) |