Skip to content

Migration is not dumping UUID default settings to schema #10751

xph opened this Issue May 25, 2013 · 3 comments

3 participants

xph commented May 25, 2013

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?

kennyj commented May 31, 2013

related to #10605

kennyj commented May 31, 2013

@xph I've submited PR to fix this problem. Please comment to #10811 :)

@kennyj kennyj closed this in 4734e4e Sep 22, 2013
mrbrdo commented Nov 21, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.