Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Migration is not dumping UUID default settings to schema #10751

Closed
xph opened this Issue · 3 comments

3 participants

@xph

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()'
end

but when I rake db:migrate, the schema.rb shows

create_table "users", id: false, force: true do |t|
    t.uuid     "id",         null: false
end

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
Collaborator

related to #10605

@kennyj
Collaborator

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

@kennyj kennyj closed this in 4734e4e
@mrbrdo

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.