I recently had a long discussion with David Heinemeier Hansson. I was
a bit annoyed at the fact that rake db:reset was changed to use the
schema file.

Here is my explanation of how I use rake db:reset

I've been using rake db:reset mainly in the testing environment. Since
I do TDD, I usually don't create a migration all at once.
I write a test, generate the migration needed for the test to pass,
add the code, migrate, test passes. I refactor, write another test,
modify the migration, db:reset, write more code, test passes. I also
use rake:db:reset to make sure migrations won't break.

David made a good point saying that:

You're just iterating over one migration, which
db:rollback + db:migrate would deal with. I can sympathize with that
one. I just don't see the need to run ALL migrations again. Especially
not on production systems that might have hundreds of migrations.

I definitely get the point of verifying the current migration you're
working on. Perhaps something like db:regrate => [ db:rollback,
db:migrate ] would solve that case?

----

db:rollback has a nice STEP option that let's you migrate 'back' few
versions.

rake db:build is a good idea, but David made clear that we should use
the schema.rb file to bring your db to the latest state. On top of
that I don't understand the need to clone your dev env to your test
development.

rake db:create:test is the same as rake db:create RAILS_ENV=test or
rake db:create:all

----

I'll submit a patch for rake db:regrate  if you have a suggestion for
a better name, please post here or on the track ticket.

-Matt


On Nov 29, 6:27 pm, Robert Evans <[EMAIL PROTECTED]>
wrote:
> I've created 3 rake tasks:
>
> rake db:create:test
> rake db:build
> rake db:rebuild
>
> The first creates your test database. The second, creates your
> development database, migrates it, creates the test database and then
> clones the development database to the test database.a
>
> Lastly, the third drops your database (dev), creates it, migrates it,
> and clones it for your test database.
>
> For a few projects, I've gotten tired of doing: rake db:drop && rake
> db:create && rake db:migrate && rake db:test:clone
>
> link:http://dev.rubyonrails.org/ticket/10316
>
> What do you guys think, +1's?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to