diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-04-26 22:25:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-26 22:25:04 -0700 |
commit | 1583e260f9278986f3c4ea3702c081727838c290 (patch) | |
tree | 73fad0fc1b0261e601d147d5300ad24b2366dbe7 /activerecord/test | |
parent | 9e08e8bbb105ceb429afd2cad8287f026f3c677e (diff) | |
parent | 4181b677e5164a18fe25767c5bf9eeb3df800231 (diff) | |
download | rails-1583e260f9278986f3c4ea3702c081727838c290.tar.gz rails-1583e260f9278986f3c4ea3702c081727838c290.tar.bz2 rails-1583e260f9278986f3c4ea3702c081727838c290.zip |
Merge pull request #28883 from yahonda/fix28797
PostgreSQL 10 does not convert `CURRENT_DATE` into `('now'::text)::date`
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/defaults_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb index a6297673c9..996d298689 100644 --- a/activerecord/test/cases/defaults_test.rb +++ b/activerecord/test/cases/defaults_test.rb @@ -87,9 +87,14 @@ if current_adapter?(:PostgreSQLAdapter) test "schema dump includes default expression" do output = dump_table_schema("defaults") - assert_match %r/t\.date\s+"modified_date",\s+default: -> { "\('now'::text\)::date" }/, output + if ActiveRecord::Base.connection.postgresql_version >= 100000 + assert_match %r/t\.date\s+"modified_date",\s+default: -> { "CURRENT_DATE" }/, output + assert_match %r/t\.datetime\s+"modified_time",\s+default: -> { "CURRENT_TIMESTAMP" }/, output + else + assert_match %r/t\.date\s+"modified_date",\s+default: -> { "\('now'::text\)::date" }/, output + assert_match %r/t\.datetime\s+"modified_time",\s+default: -> { "now\(\)" }/, output + end assert_match %r/t\.date\s+"modified_date_function",\s+default: -> { "now\(\)" }/, output - assert_match %r/t\.datetime\s+"modified_time",\s+default: -> { "now\(\)" }/, output assert_match %r/t\.datetime\s+"modified_time_function",\s+default: -> { "now\(\)" }/, output end end |