Skip to content

Comment on Rails 4 UUID primary keys with PostgreSQL

Comments

I commented on the OP's article, but do this for the pk:

    create_table(:users, id: :uuid) do |t|
      t.string 'name'
    end
And to make sure the extension is enabled, (in your migrations) do:
    enable_extension 'uuid-ossp'
For now, make sure to use SQL schema dumping. I don't think Ruby schema files will work (as I haven't written a test for it yet).

EDIT: I forgot to mention, you can enable hstore by using "enable_extension('hstore')"

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.