mercredi 10 février 2016

Still get Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development even after migration & deleting duplicate file

I'm creating an app in my local environment (http://localhost:3000/) using Ruby on Rails.

I get the following error despite already running 'rake db:migrate' :

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

When I ran 'rake db:migrate' I originally got:

 Multiple migrations have the name CreateDeliveries

So I went into the db/migrate folder and deleted the redundant create_deliveries.rb file.

Now I get the following error message when I run rake db:migrate :

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "deliveries" already exists: 
CREATE TABLE      "deliveries" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL, "name" varchar, "deliveryaddress" varchar, "deliverytime" integer, 
"notes" varchar, "orders_id" integer, "created_at" datetime NOT NULL, 
"updated_at" datetime NOT NULL) /usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3- 1.3.11/lib/sqlite3/database.rb:91:in `initialize'

When I run rake db:migrate:status it also yields:

Migration Name: Create orders, status: up
Migration Name: Create deliveries, status: down
Migration Name: *******NO FILE*******, status: up

How do I fix this error?

Aucun commentaire:

Enregistrer un commentaire