My question, if this is my migration:

*migration.rb*
def change

connection.execute <<-SQLCREATE OR REPLACE FUNCTION john_uuid_generator()
RETURNS uuidAS $$ SELECT * FROM #{uuid_function} $$LANGUAGE SQL VOLATILE;SQL

end


Where do I define john_uuid_generator()?

Thanks!


On Mon, Jul 10, 2017 at 2:10 PM, Matt Hickman <matt.hick...@gmail.com>
wrote:

> uuid_function is defined - https://github.com/rails/rails/blob/
> 650ea5e5cf50d8a7242499463cf1762922d330a8/activerecord/test/
> cases/adapters/postgresql/uuid_test.rb#L14 - it just switches on if
> postgres supports gen_random_uuid() otherwise it uses uuid_generate_v4()
>
> gen_random_uuid() is part of the pgcrypto module -
> https://www.postgresql.org/docs/9.5/static/pgcrypto.html
>
> uuid_generate_v4() is part of the uuid-ossp module -
> https://www.postgresql.org/docs/9.5/static/uuid-ossp.html
>
> johnpearson...@gmail.com
> July 10, 2017 at 12:39 PM via Postbox
> <https://www.postbox-inc.com/?utm_source=email&utm_medium=sumlink&utm_campaign=reach>
> That's what I thought but I wasn't sure where to place the uuid_function
> <https://github.com/rails/rails/blob/650ea5e5cf50d8a7242499463cf1762922d330a8/activerecord/test/cases/adapters/postgresql/uuid_test.rb#L13>
>  that
> the migration refers to. So that go in a helper file or part of the
> migration?
>
> On Monday, July 10, 2017 at 4:38:06 AM UTC-7, Matt Hickman wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/ea4c0dbb-317d-428a-9534-
> 80ca70b1e2f3%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/ea4c0dbb-317d-428a-9534-80ca70b1e2f3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Matt
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/rubyonrails-talk/5Y-7-LLFKGw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/rubyonrails-talk/5963ED2A.8060808%40gmail.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/5963ED2A.8060808%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAKNtY_x1qm_VXqcUdMXQ8pytHQF2tFuLAmgnv%2Bvf-8uZGXBMqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to