This project is archived and is in readonly mode.
rake db:seed should check if the database have pending migrations
Reported by Thiago Pradi | July 20th, 2010 @ 07:04 PM
Hi guys,
I'm using rake db:seed to populate my database, but I found a weird behavior.
The scenario:
tchandy ~ $ rails new sample_application
create
create README
....
tchandy ~ $ cd sample_application/
tchandy ~/sample_application $ rails g model User name:string
invoke active_record
create db/migrate/20100720174836_create_users.rb
create app/models/user.rb
invoke test_unit
create test/unit/user_test.rb
create test/fixtures/users.yml
This is my seeds.rb:
User.create!(:name => "Thiago")
When I run:
tchandy ~/sample_application $ rake db:seed
(in /Users/tchandy/sample_application)
rake aborted!
Could not find table 'users'
(See full trace by running task with --trace)
Is this behaviour normal? My opinion is that rake db:seed should check if the database have pending migrations.
The attached patch checks if the database have pending migrations, and after this, runs the db:seed.
Comments and changes to this ticket
-
Rohit Arondekar July 21st, 2010 @ 01:46 AM
- Importance changed from to Low
Can you add test(s) for this?
-
José Valim July 21st, 2010 @ 01:55 PM
Rohit, unfortunately there is no easy/fast way to add tests for rake tasks. So I will apply it as it is. Thanks!
-
Repository July 21st, 2010 @ 02:08 PM
- State changed from new to resolved
(from [c96a50539121c4a722f354220c7f0e314b24804d]) rake db:seed should check if the database have pending migrations [#5163 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/c96a50539121c4a722f354220c7f0e...
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
Attachments
Referenced by
- 5163 rake db:seed should check if the database have pending migrations (from [c96a50539121c4a722f354220c7f0e314b24804d]) rake db...