# Bug in schema.rb generation during db:migrate

**URL:** <https://www.ruby-forum.com/t/bug-in-schema-rb-generation-during-db-migrate/154927>\
**Category:** Rails\
**Created:** [December 5, 2008, 7:39am UTC](https://www.ruby-forum.com/t/bug-in-schema-rb-generation-during-db-migrate/154927 "2008-12-05T07:39:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teedub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f475e1/32.png) [@Teedub](https://www.ruby-forum.com/u/Teedub)\
**Post date:** [December 5, 2008, 7:39am UTC](https://www.ruby-forum.com/t/bug-in-schema-rb-generation-during-db-migrate/154927/1 "2008-12-05T07:39:34Z")

</div>

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
