I'm using Rails 4.0.0.rc1 and postgresql. In a migration, I'm creating a table that sets UUID version 1 as the primary key, as follows:
create_table :users, id: false do |t|
t.primary_key :id, :uuid, default: 'uuid_generate_v1()'
but when I rake db:migrate, the schema.rb shows
create_table "users", id: false, force: true do |t|
t.uuid "id", null: false
With no default option. Everything works fine until I have to do rake db:schema:load, which won't load the default and then PG will throw errors at me whenever I try to save anything into the database. I find I have to rollback and re-migrate to get it to work, which is very annoying.
Anyone else getting this behavior?
related to #10605
Migration dump UUID default functions to schema.rb. Fixes #10751.
@xph I've submited PR to fix this problem. Please comment to #10811 :)
I have this bug in 4.0.0. Has this ever been fixed? Even though that PR was merged I can't seem to find that fix in the current master, but code has changed a bit since. cc @kennyj