Forum: Ruby on Rails Bug in schema.rb generation during db:migrate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D3fe2dc4435cdd79e58d3e1380a557a1?d=identicon&s=25 Teedub (Guest)
on 2008-12-05 07:39
(Received via mailing list)
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
This topic is locked and can not be replied to.