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.

Changing id column to string "breaks" schema.rb

#2116

When you change the datatype of your id column with a migration like

change_column :users, :id, :string

your schema.rb will not contain this column:

...
create_table "users", :force => true do |t|
  t.string   "email"
  t.string   "pwd_hash"
  t.boolean  "is_active"
  t.datetime "last_activity"
  t.string   "pwd_salt"
  t.string   "activation_key"
  t.datetime "signup_date"
end 

So you will end up with

rake db:migrate

and

rake db:schema:load

creating different schemas.

Same behavior when your create a table with

create_table :objects, :id => false do |t|
  t.string :id
end

Reported by Martin Vielsmaier · March 3rd, 2009 @ 08:21 AM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Nathaniel Bibler
  2. jacob swanner (jswanner)
  3. jacob swanner (jswanner)
    jacob swanner (jswanner)
    • Tag changed from activerecord, schema to activerecord, patch, schema

    November 24th, 2009 @ 08:38 PM

  4. Tyler Hunt
  5. Tyler Hunt
    Tyler Hunt
    • Tag set to activerecord, patch, schema

    November 24th, 2009 @ 08:59 PM

  6. Elliot Winkler
    Elliot Winkler
    1. I'm running into this problem right now. I use schema.rb to create the test db but I end up having to modify it before I do so. Fortunately it doesn't happen that much but it should never have to happen.

    November 25th, 2009 @ 02:46 PM

  7. Jared Martin
  8. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  9. Gabor Ratky
    Gabor Ratky
    • Importance changed from to

    +1, we're reusing the id space of an external service as our own PK's and it goes beyond 2 ** 31 - 1

    July 19th, 2010 @ 11:36 AM

  10. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    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:51 PM

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

    February 2nd, 2011 @ 04:51 PM