In the migration that I want to create, the primary key of the table is a field called "id" but it is not an auto-incrementing integer. It's datatype should be uniqueidentifier (a uuid). Here is what I have tried:
create_table :some_things, :id => false do |t|
t.column :id, :uniqueidentifier, :primary => true
t.column :name, :string, :limit => 255
t.column :type, :tinyint
t.column :deleted_flag, :bit
t.column :class_id, :uniqueidentifier
t.timestamps
end
This creates the table alright, but there is no primary key (because I said :id=>false). If I said "create_table :some_things, :id => true, :primary => :id", then "id" becomes the primary key, but it is an auto-incrementing integer, not a non-auto-incrementing uuid.
How can I make this migration work so that the primary key is a field called "id" of type "uniqueidentifier" (non-auto-incrementing)?
I'm using: SQL Server 2008, Rails / ActiveRecord 3.0.3, гем activerecord-sqlserver-adapter, и соединение ODBC.