How to run all migrations in reverse in rails 3.1 - ruby-on-rails-3

I want to run rake db:migrate:down on all of my migrations in rails 3.1. Some other questions suggest doing rake db:migrate:down VERSION=0, but that gives me this error:
No migration with version number 0

Use rake db:migrate VERSION=0

Related

Rake aborting with Devise installation on Ruby - cannot migrate the db

I'm trying my hands on Ruby on Rails and needed to set up a simple authentication using devise. I followed the instructions however I'm constantly getting the following error:
>rake db:migrate
rake aborted!
uninitialized constant User
Tasks: TOP => db:migrate => environment
I get this error every time I try to run rake db:migrate - the migrate file does exist in the db/migrate folder but it wont proceed further. Please help.
Run the rake command in trace mode, and the error will become visible.
rake db:migrate --trace
First remove devise_for :users line from routes.rb file then try to run rake db:migrate.

spree install errors

i am following the guide at http://guides.spreecommerce.com/getting_started.html
all's ok until i run
bundle exec rake spree_sample:load
rake says
Don't know how to build task 'spree_sample:load'
if i decide to skip that and do
rake db:bootstrap
it says
Table 'myproject_development.countries' doesn't exist
if alternatively i run
rake db:migrate
rake db:seed
rake spree_sample:load
it also says
Don't know how to build task 'spree_sample:load'
if i still continue that and run
rake db:admin:create
i get another error:
no such file to load -- /home/pavel/cetsy/db/sample/users.rb
bundler information:
...
Using rails (3.0.9)
...
Using spree_core (0.60.1)
Using spree_auth (0.60.1)
Using spree_api (0.60.1)
Using spree_dash (0.60.1)
Using spree_promo (0.60.1)
Using spree_sample (0.60.1)
Using spree (0.60.1)
Simon was right, upgrading rails and spree to 3.1.1/0.70 partially solved the issue
now, running
bundle exec rake spree_sample:load
still produces
Don't know how to build task 'spree_sample:load'
but skipping this step lets me finish installing spree without other problems

rake db:seed issue

I'm seeing a weird issue here when I run rake db:seed or rake db:migrate:
user#ubuntu:~/Desktop/staging/config$ bundle show activeresource
/usr/lib/ruby/gems/1.8/gems/activeresource-3.0.3
user#ubuntu:~/Desktop/staging/config$ rake db:seed
(in /home/rohan/Desktop/staging)
Could not find activesupport-3.0.3 in any of the sources
Try running `bundle install`.
user#ubuntu:~/Desktop/staging/config$ ruby --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
I don't know what to do. Any help would be appreciated. For the record, I am using RVM.
Run bundle install. This will fix the problem.
you need to require rails in gemfile then run bundle install.
gem "rails", 'version'
now run bundle install
On the assumption that you tried running bundle install like it asked, you probably just need to use:
$ bundle exec rake db:seed
to run rake in the context of the bundle.

After Rails 3 upgrade rake db:test:prepare not working?

I have just gone through the process of upgrading a Rails 2.3.11 app that uses Test Unit to Rails 3.1.rc4 and I have now set up rspec-rails 2.6.1.
I also switch the test connection in database.yml to use sqlite instead of postgres.
I can run rake db:migrate and db:test:prepare all day, but in my model tests I get "Could not find table 'model_name'".
Has anyone else ran into this?
I did encounter this before. Try rebuilding it from scratch:
rake db:drop RAILS_ENV=test
rake db:create RAILS_ENV=test
rake db:migrate RAILS_ENV=test
What does select * from schema_migrations show you? Verify that the migrations you expect have all actually been stored. If you know which migration failed you can use rake db:migrate:redo VERSION=<VERSION>
Apologies for not being a comment. StackOverflow's "can't comment until 50" policy seems a bit backwards :)

Rails 3.1 engine rake task doesnt work

I created a new engine with Rails 3.1.rc1
➜ (ruby-1.9.2-p180#rails3-pre) rails git:(master) be bin/rails plugin new ../first_engine --mountable
rails g scaffold project title:string
Scaffold is generated and now when I run
bundle exec rake db:migrate
I get the following error:
rake aborted!
Don't know how to build task 'app:db:migrate'
Tasks: TOP => db:migrate
Before rc1, it was working. But what happened now? I couldn't figure it out!
Here is the gist with all the steps and backtraces https://gist.github.com/990641
Can anyone put me the right direction?
In you Gemfile or RVM Global Gemset file. Change rake to include the version. e.g.
gem 'rake', '0.8.7'
Just using rake will not work until Rails comes out with a fix. Let us know how you get on. All the best.