This project is archived and is in readonly mode.

#3540 ✓invalid
davetenhave

Malformed migrations result in odd column names

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

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>

Comments and changes to this ticket

  • Mike Riley

    Mike Riley June 21st, 2010 @ 01:34 AM

    • 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

  • José Valim

    José Valim June 22nd, 2010 @ 04:41 PM

    • State changed from “new” to “invalid”

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

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages