jeudi 26 février 2015

Testing with rspec is causing an error: `Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development `


when I run the rails server, localhost displays this error:

ActiveRecord::PendingMigrationError (Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development):


I have run the bin/rake... and the next error says:




$ bundle exec bin/rake db:migrate RAILS_ENV=development
== 20150225172130 CreateVotes:
migrating ======================================
-- create_table(:votes)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "votes" already exists: CREATE TABLE "votes"
("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "value" varchar(255),
"user_id" integer, "post_id" integer, "created_at" datetime, "updated_at"
datetime)


_create_votes.rb



class CreateVotes < ActiveRecord::Migration
def change
create_table :votes do |t|
t.string :value
t.references :user, index: true
t.references :post, index: true

t.timestamps
end
end
end





Basically, it tells me I have migrations pending, but when I attempt to migrate it says the table already exists.






20150225172130 CreateVotes:
migrating ======================================
-- create_table(:votes)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "votes" already exists: CREATE TABLE "votes"...

Aucun commentaire:

Enregistrer un commentaire