diff --git a/activerecord/test/cases/migration/columns_test.rb b/activerecord/test/cases/migration/columns_test.rb index 51260e68a067..7eac8ab752db 100644 --- a/activerecord/test/cases/migration/columns_test.rb +++ b/activerecord/test/cases/migration/columns_test.rb @@ -347,15 +347,17 @@ def test_change_column_null_with_non_boolean_arguments_raises end def test_change_column_null_does_not_change_default_functions - skip unless current_adapter?(:Mysql2Adapter, :TrilogyAdapter) + skip unless current_adapter?(:Mysql2Adapter, :TrilogyAdapter) && supports_default_expression? - connection.change_column_default "test_models", "created_at", -> { "(NOW())" } + function = connection.mariadb? ? "(current_timestamp())" : "(now())" + + connection.change_column_default "test_models", "created_at", -> { function } TestModel.reset_column_information - assert_equal "(now())", TestModel.columns_hash["created_at"].default_function + assert_equal function, TestModel.columns_hash["created_at"].default_function connection.change_column_null "test_models", "created_at", true TestModel.reset_column_information - assert_equal "(now())", TestModel.columns_hash["created_at"].default_function + assert_equal function, TestModel.columns_hash["created_at"].default_function end def test_remove_column_no_second_parameter_raises_exception