diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-30 08:35:59 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-05-30 08:59:43 +0900 |
commit | a0d17760bbc6254e0231a42300c842501aca080e (patch) | |
tree | 01475224264859769b7719febd95d4c2bf1aec89 /activerecord/test | |
parent | 0a9522a8b316171d083623cd9dd50f2aa21efb2c (diff) | |
download | rails-a0d17760bbc6254e0231a42300c842501aca080e.tar.gz rails-a0d17760bbc6254e0231a42300c842501aca080e.tar.bz2 rails-a0d17760bbc6254e0231a42300c842501aca080e.zip |
Fix UUID column with `null: true` and `default: nil`
`quote_default_expression` can be passed nil value when `null: true` and
`default: nil`. This addressed in that case.
Fixes #29222.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/uuid_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 52e4a38cae..6ebe9d82a7 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -63,6 +63,16 @@ class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase UUIDType.reset_column_information end + def test_add_column_with_null_true_and_default_nil + assert_nothing_raised do + connection.add_column :uuid_data_type, :thingy, :uuid, null: true, default: nil + end + UUIDType.reset_column_information + column = UUIDType.columns_hash["thingy"] + assert column.null + assert_nil column.default + end + def test_data_type_of_uuid_types column = UUIDType.columns_hash["guid"] assert_equal :uuid, column.type |