I am trying to use the UUID as the primary key for a Rails application, and I ran into a problem after the problem.
I specify the following in the migration: create_table: users ,: id => false do | t | then this is: execute ("ALTER TABLE ADD PRIMARY KEY (uuid) users")
In my user model: set_primary_key "uuid"
Using UUID tools to generate UUIDs.
This all works great, the problem I'm currently experiencing is that the generated schema.rb looks like this:
create_table "users" ,: primary_key => "uuid" ,: force => true do | t |
The primary key column is assumed to be an integer of 11 characters, not 36 characters, so the migrations performed create the correct database, but the test database is not generated correctly, and if I need to run rake db: schema: load, this will also fail ...
You need to figure out how to override the way that schema.rb assumes that if there is an integer in the primary key column ....
ruby-on-rails
Gordon isnor
source share