Error while running rake db:migrate


#1

Hi all,

While I am running rake db:migrate . I am getting the below error

$ rake db:migrate rake aborted! Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.3.2. Prepending bundle exec to your command may solve this. /var/lib/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:34:in block in setup' /var/lib/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/runtime.rb:19:insetup' /var/lib/gems/2.0.0/gems/bundler-1.7.3/lib/bundler.rb:121:in setup' /var/lib/gems/2.0.0/gems/bundler-1.7.3/lib/bundler/setup.rb:7:in' /home/ccuser/workspace/learn-rails-one-model/config/boot.rb:4:in <top (required)>' /home/ccuser/workspace/learn-rails-one-model/config/application.rb:1:in' /home/ccuser/workspace/learn-rails-one-model/Rakefile:4:in `' (See full trace by running task with --trace)
regards
Bharath


#2

Try
bundle exec rake db:migrate


#3

If you look at the full error message, you'll see something like this:

$ rake db:migrate
== 20160715165214 CreateMessages: migrating =========
==========================
-- create_table(:messages)
rake aborted!
StandardError: An error has occurred, this and all la
ter migrations canceled:

SQLite3::SQLException: table "messages" already exist
s: CREATE TABLE "messages" ...

You can fix this problem by going into db/migrate, opening the migration file, and changing :messages in the change method to something different like :message .