I’m trying to use a UUID as the primary key for a Rails app, and am running into problem after problem.
I am specifying in migration this: create_table :users, :id => false do |t| then this: execute("ALTER TABLE users ADD PRIMARY KEY(uuid)")
In my user model: set_primary_key "uuid"
Using the UUID tools to generate the UUID.
This is all working great, the problem I currently have is that the schema.rb that gets generated looks like this:
create_table "users", :primary_key => "uuid", :force => true do |t|
Which assumes that the primary key column is an 11 character integer rather than a 36 character string, so running migrations produces a correct database, but test database is generated incorrectly, and if I were to run rake db:schema:load, it would fail as well...
Need to figure out how to override the way that schema.rb assumes that if there’s a primary key column that it will be an integer....