diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-05-03 20:49:45 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-01-13 22:03:56 +0900 |
commit | 5fd30ac52d9f8fcdba98b92cdb82868f6686596c (patch) | |
tree | 9903a3d3f2be13dc57a9607fffa16315767e75e5 /activerecord/test/cases/adapters/postgresql | |
parent | f5ab4055b909e7b325304c5a7e414c28bbe441b7 (diff) | |
download | rails-5fd30ac52d9f8fcdba98b92cdb82868f6686596c.tar.gz rails-5fd30ac52d9f8fcdba98b92cdb82868f6686596c.tar.bz2 rails-5fd30ac52d9f8fcdba98b92cdb82868f6686596c.zip |
Add expression support on the schema default
Example:
create_table :posts do |t|
t.datetime :published_at, default: -> { 'NOW()' }
end
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/uuid_test.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 3d90790367..7628075ad2 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -197,14 +197,14 @@ class PostgresqlUUIDGenerationTest < ActiveRecord::PostgreSQLTestCase def test_schema_dumper_for_uuid_primary_key schema = dump_table_schema "pg_uuids" - assert_match(/\bcreate_table "pg_uuids", id: :uuid, default: "uuid_generate_v1\(\)"/, schema) - assert_match(/t\.uuid "other_uuid", default: "uuid_generate_v4\(\)"/, schema) + assert_match(/\bcreate_table "pg_uuids", id: :uuid, default: -> { "uuid_generate_v1\(\)" }/, schema) + assert_match(/t\.uuid "other_uuid", default: -> { "uuid_generate_v4\(\)" }/, schema) end def test_schema_dumper_for_uuid_primary_key_with_custom_default schema = dump_table_schema "pg_uuids_2" - assert_match(/\bcreate_table "pg_uuids_2", id: :uuid, default: "my_uuid_generator\(\)"/, schema) - assert_match(/t\.uuid "other_uuid_2", default: "my_uuid_generator\(\)"/, schema) + assert_match(/\bcreate_table "pg_uuids_2", id: :uuid, default: -> { "my_uuid_generator\(\)" }/, schema) + assert_match(/t\.uuid "other_uuid_2", default: -> { "my_uuid_generator\(\)" }/, schema) end end end |