parent
2384148cbe
commit
9541a72858
@ -123,6 +123,7 @@ def table(table, stream)
|
||||
tbl.print %Q(, primary_key: "#{pk}")
|
||||
elsif pkcol.sql_type == 'uuid'
|
||||
tbl.print ", id: :uuid"
|
||||
tbl.print %Q(, default: "#{pkcol.default_function}") if pkcol.respond_to?(:default_function) && pkcol.default_function
|
||||
end
|
||||
else
|
||||
tbl.print ", id: false"
|
||||
|
@ -24,7 +24,7 @@ def setup
|
||||
@connection.reconnect!
|
||||
|
||||
@connection.transaction do
|
||||
@connection.create_table('pg_uuids', id: :uuid) do |t|
|
||||
@connection.create_table('pg_uuids', id: :uuid, default: 'uuid_generate_v1()') do |t|
|
||||
t.string 'name'
|
||||
t.uuid 'other_uuid', default: 'uuid_generate_v4()'
|
||||
end
|
||||
@ -60,7 +60,7 @@ def test_pk_and_sequence_for_uuid_primary_key
|
||||
def test_schema_dumper_for_uuid_primary_key
|
||||
schema = StringIO.new
|
||||
ActiveRecord::SchemaDumper.dump(@connection, schema)
|
||||
assert_match(/\bcreate_table "pg_uuids", id: :uuid\b/, schema.string)
|
||||
assert_match(/\bcreate_table "pg_uuids", id: :uuid, default: "uuid_generate_v1\(\)"/, schema.string)
|
||||
assert_match(/t\.uuid "other_uuid", default: "uuid_generate_v4\(\)"/, schema.string)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user