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.

Migrations silently fail when passed invalid field [data] type

#3303

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

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

State: stale
Milestone: none
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Austin
    Austin
    • 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.

    November 12th, 2009 @ 06:28 PM

  2. Ryan Bigg
    Ryan Bigg
    • Tag changed from 2.3.4, data, invalid, migrations, type to 2.3.4, data, migrations, type
    • Assigned user set to Pratik

    April 14th, 2010 @ 05:17 AM

  3. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 2nd, 2011 @ 04:43 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:43 PM