This project is archived and is in readonly mode.

#3303 ✓stale
Daniel Heath

Migrations silently fail when passed invalid field [data] type

Reported by Daniel Heath | September 29th, 2009 @ 02:49 AM

The following, when run as part of a migration, should warn the user that the field was not created as it was invalid. Instead, it is silently ignored.

create_table "account_services", :force => true, :primary_key => "record_id" do |t|
t.fail "should report an error" end

Running Rails 2.3.4

Comments and changes to this ticket

  • Austin

    Austin November 12th, 2009 @ 06:28 PM

    • Tag changed from 2.3.4, migrations to 2.3.4, data, invalid, migrations, type
    • Title changed from “Migrations silently fail when passed invalid field type” to “Migrations silently fail when passed invalid field [data] type”

    I just ran into the same issue. I had a typo in my migration, and thus the field wasn't created. I scratched my head for a while, wondering why my database didn't have the field, yet it was in my migration file!

    Here's the full migration (it was a HMT model):
    class CreateEmployeeSoftwares < ActiveRecord::Migration
      def self.up
        create_table :employee_softwares do |t|
          t.integer       :software_id
          t.intger        :employee_id
          t.timestamps
        end
      end
    
      def self.down
        drop_table :employee_softwares
      end
    end
    

    Notice I had t. "intger", I was missing an "e". At no point did the migration fail or warn me that "intger" isn't a valid data type.

  • Ryan Bigg

    Ryan Bigg April 14th, 2010 @ 05:17 AM

    • Tag changed from 2.3.4, data, invalid, migrations, type to 2.3.4, data, migrations, type
    • Assigned user set to “Pratik”
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • State changed from “new” to “open”
    • Tag changed from 2.3.4, data, migrations, type to 234, data, migrations, type
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:43 PM

    • State changed from “open” to “stale”

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>

People watching this ticket

Pages