Bug in schema.rb generation during db:migrate


#1

I am thinking that I have found a bug in Rails migrations. My app is
using UUIDtools to generate guids for primary keys. To do this I
pass :id=>false and then create my own id column as shown below. Next
I leverage “execute” to create an index. It seems to work fine. The
table in MySql is perfect. However the ID column and primary key on
the ID column are not in the schema.rb file
I am pretty sure this issue is the same as Ticket #11198 but I can’t
figure out how to add this to that defect. How do I figure out the
status of defect 11198? It says [PATCH] What does that mean? Is this
supposed to be fixed? If so, how do I reopen the defect?

Thanks in advance.

TW Scannell

class CreateVenues < ActiveRecord::Migration
def self.up

create_table(:venues,  :id => false) do |t|
  t.string :id, :limit => 36, :null => false
  t.string :name, :null => false
  t.string :address, :null => false
  t.string :city, :null => false
  t.string :state, :null => false
  t.string :zip, :null => false
  t.string :phone1
  t.string :phone2
  t.string :fax
  t.string :geocode, :null => false

  t.timestamps
end
execute "ALTER TABLE `venues` ADD PRIMARY KEY (`id`)"

end

def self.down
drop_table :venues
end
end

schema.rb

create_table “venues”, :force => true do |t|
t.string “name”, :null => false
t.string “address”, :null => false
t.string “city”, :null => false
t.string “state”, :null => false
t.string “zip”, :null => false
t.string “phone1”
t.string “phone2”
t.string “fax”
t.string “geocode”, :null => false
t.datetime “created_at”
t.datetime “updated_at”
end

mysql Which is correct

CREATE TABLE venues (
id varchar(36) NOT NULL,
name varchar(255) NOT NULL,
address varchar(255) NOT NULL,
city varchar(255) NOT NULL,
state varchar(255) NOT NULL,
zip varchar(255) NOT NULL,
phone1 varchar(255) default NULL,
phone2 varchar(255) default NULL,
fax varchar(255) default NULL,
geocode varchar(255) NOT NULL,
created_at datetime default NULL,
updated_at datetime default NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8