jeudi 24 janvier 2019

Migration in Rails gives back could not find table error

I made a new migration in order to add a price column in my Ingredients Active Record. Despite that when I run rails db:migrate I get an error saying that the table ingredients does not exist. Here are my console commands:

 C:\Users\andri\Desktop\hoagieShop\hoagieShop>rails generate migration 
 AddPriceToIngredients price:decimal, false:null --force
  invoke  active_record
  remove    db/migrate/20190124075954_add_price_to_ingredients.rb
  create    db/migrate/20190124080657_add_price_to_ingredients.rb

C:\Users\andri\Desktop\hoagieShop\hoagieShop>rails db:migrate
== 20190123201200 RemovePriceFromIngrendients: migrating 
======================
-- remove_column(:ingrendients, :price, :decimal)
rails aborted!
StandardError: An error has occurred, this and all later migrations 
canceled:
Could not find table ingrendients 
C:/Users/andri/Desktop/hoagieShop/hoagieShop/db/migrate/201901232 
01200_remove_price_from_ingrendients.rb:3:in change
bin/rails:4:in require
bin/rails:4:in <main>

Caused by:
ActiveRecord::StatementInvalid: Could not find table ingrendients


C:/Users/andri/Desktop/hoagieShop/hoagieShop/db/migrate/20190123201200_
remove_pr 
ice_from_ingrendients.rb:3:in change
bin/rails:4:in require
bin/rails:4:in <main>
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I have removed and added this migration again a few times so I am not sure if this plays any role. Does anyone have an idea as to why this happens? I appreciate any help!

Aucun commentaire:

Enregistrer un commentaire