Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Malformed migrations result in odd column names

#3540

The following migration (note the daggy comma after 'node_id'):

create_table :foo do |t|

  t.integer :node_id,
  t.timestamps

end

Results in the table 'Foo' containing the following columns:

node_id
#<ActiveRecord::ConnectionAdapters::TableDefinition:0x33e7d3c>

Reported by davetenhave · December 4th, 2009 @ 02:32 AM

State: invalid
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Mike Riley
    Mike Riley
    • Tag changed from 2.3.5, migrations, mysql to 2.3.5, 2.3.8, migrations, mysql

    Hello,

    I took a look at this and based on the above I was able to replicate this.

    a) created a model named foo
    b) updated the migration to do the following:

    create_table :foos do |t|
    t.integer :node_id, t.timestamps end

    c) ran rake db:migrate, looked at the database and found this:

    | node_id | int(11) | YES | | NULL | | | #<ActiveRecord::ConnectionAdapters::TableDefinition:0x10317a080> | int(11) | YES | | NULL | |

    d) this was tested against Rails 2.3.8.

    Mike Riley
    twitter.com/wdperson

    June 21st, 2010 @ 01:34 AM

  2. José Valim
    José Valim
    • State changed from new to invalid

    Unfortunately this is a typo that happened and there is not much we can do about this.

    June 22nd, 2010 @ 04:41 PM