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.

Rake tasks are weird in 3.0.3 (db:migrate/setup)

#6336

Hello there,

Ruby 1.9.2
Rails 3.0.3
Sqlite3

I got a model like this;

class PdVersion < ActiveRecord::Base

  belongs_to :transportation
  has_many :cenarios
  has_many :users

  scope :least_users, find_by_sql("SELECT \"pd_versions\".* FROM \"pd_versions\" WHERE (outlying = 't' AND line_qty = 1 AND users_count = (SELECT MIN(users_count) from \"pd_versions\") )").first
  
end

when I run db:migrate it tells me that the pd_versions table was not found. So I assume for some weird reason, db:migrate is trying to run my scope there, which is a lot of weirdness.

Another thing is, db:setup, which was supposed to be db:migrate + db:seed right? Well when you run it, db:setup doesn't recreate the schema.rb, it keeps the same file so the migration (if you changed a migration, I know its a bad practice) it wont reflect the latest changes.

[]'s Rodrigo Dellacqua

Edited by Rohit Arondekar for formatting.

Reported by rgoytacaz (at gmail) · January 26th, 2011 @ 04:31 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Rohit Arondekar
    Rohit Arondekar
    • Importance changed from to Low

    Rodrigo could you please also show the code generated in the migration? I'm guessing the reason for the error will be in there.

    January 27th, 2011 @ 06:45 AM

  2. rails
    rails
    • State changed from new to open
    • Tag changed from rake tasks db:migrate db:setup to rake tasks dbmigrate dbsetup

    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.

    April 29th, 2011 @ 01:00 AM

  3. rails
    rails
    • State changed from open to stale

    April 29th, 2011 @ 01:00 AM