Forum: Ruby on Rails Upgrade issue

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F12e71096774b459e8e8f61b0c289945?d=identicon&s=25 newbie (Guest)
on 2007-07-13 17:15
(Received via mailing list)
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?

6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2007-07-13 18:27
(Received via mailing list)
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 Hogan
This topic is locked and can not be replied to.