I'm working on a Rails 5 project and I've added various columns to some of my tables and created a new table as well. This obviously has created a few migration files and I would like to revert back to a certain migration and delete all the changes in the schema that were made after this migration. How do I do this?
Schema.rb:
ActiveRecord::Schema.define(version: 20180814220216) do
create_table "stores", force: :cascade do |t|
t.string "name"
t.string "address"
t.float "beer_cost"
t.text "facilities"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.float "latitude"
t.float "longitude"
t.boolean "toilet"
t.string "address_line2"
t.string "address_line3"
t.integer "user_id"
t.integer "toilet_id"
t.string "toilet_available"
end
create_table "toilets", force: :cascade do |t|
t.string "toilet_available"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
end
Output after running rails db:migrate:status
Status Migration ID Migration Name
--------------------------------------------------
up 20180610144440 Create stores
up 20180611145310 Change datatype beer cost
up 20180611150425 Delete cig cost column
up 20180611231832 Add longitude and latitude
up 20180612194032 Add toilets column
up 20180614125348 Add address line2 column
up 20180614133234 Add address line3 column
up 20180625201708 Devise create users
up 20180625235156 Add user id to stores
up 20180626124327 ********** NO FILE **********
up 20180626124742 ********** NO FILE **********
up 20180627115344 ********** NO FILE **********
up 20180627115710 ********** NO FILE **********
up 20180810102513 ********** NO FILE **********
up 20180811094301 ********** NO FILE **********
up 20180814220216 ********** NO FILE **********