Upgrade issue

I upgraded from rails 1.1.6 to 1.2.3 and suddenly the db migration
stopped working…

I had the following in my migration script.

create_table :data_feeds do |t|
  # t.column :name, :string
  t.column :id, :integer
  t.column :date, :date
  t.column :domain, :string
  #...... (some lines cut here)

So Rails generated the following code, which stopped working in my
MySQL 5 after the migration.

CREATE TABLE data_feeds
(id int(11) DEFAULT NULL auto_increment PRIMARY KEY(11),
date date DEFAULT NULL,
domain varchar(255) DEFAULT NULL) ENGINE=InnoDB;

The error message was:

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that
corresponds to your MySQL server version for the right syntax to use
near '(11),

date date DEFAULT NULL,
domain varchar(255) DEFAULT NULL) ENGINE=Inn’ at line 2

So I deleted the suspicious “(11)” at the end of the 2nd line and
everything works.
Now the question is, the sql statement are auto-generated by rails. So
how can I tell Rails not to put the “(11)” at the end, or is there a
configuiration issue?


Well… you have

 t.column :id, :integer

in your migration. You don’t have to declare the :id column in a
migration… you’ve never had to as it’s automatically assumed. I wonder
that’s causing your issue.

Hope that helps!

-Brian H.