aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
diff options
context:
space:
mode:
authorEric Chahin <erc73@cornell.edu>2014-04-15 16:08:04 -0400
committerEric Chahin <erc73@cornell.edu>2014-04-15 16:08:04 -0400
commiteaa3949d36df60e6bbeccf187aa60547d6b9085b (patch)
tree4f3527435d673e3d0f345cf8f9ad81ceef05d07a /activerecord/test/cases/adapters/postgresql
parent3fce111b3bb602d0d65c76a450d0fa2d7c7b54a5 (diff)
downloadrails-eaa3949d36df60e6bbeccf187aa60547d6b9085b.tar.gz
rails-eaa3949d36df60e6bbeccf187aa60547d6b9085b.tar.bz2
rails-eaa3949d36df60e6bbeccf187aa60547d6b9085b.zip
Changed change_column in PG schema_statements.rb to make sure that the uuid_generate function was not being quoted.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r--activerecord/test/cases/adapters/postgresql/uuid_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
index 9e03ea6bee..bdf8e15e3e 100644
--- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb
@@ -40,6 +40,19 @@ class PostgresqlUUIDTest < ActiveRecord::TestCase
drop_table "uuid_data_type"
end
+ def test_change_column_default
+ @connection.add_column :uuid_data_type, :thingy, :uuid, null: false, default: "uuid_generate_v1()"
+ UUIDType.reset_column_information
+ column = UUIDType.columns.find { |c| c.name == 'thingy' }
+ assert_equal "uuid_generate_v1()", column.default_function
+
+ @connection.change_column :uuid_data_type, :thingy, :uuid, null: false, default: "uuid_generate_v4()"
+
+ UUIDType.reset_column_information
+ column = UUIDType.columns.find { |c| c.name == 'thingy' }
+ assert_equal "uuid_generate_v4()", column.default_function
+ end
+
def test_data_type_of_uuid_types
column = UUIDType.columns_hash["guid"]
assert_equal :uuid, column.type