0

I'm deploying an app for the first time and I am very confused. I'm using Fly.io with postgresql. It was working well until I added a migration "Add_cleared_boolean_to_trx".

I run #bundle exec rails db:migrate and/or #bundle exec rails db:migrate RAILS_ENV=production I get the error

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "cleared" does not exist

I thought running db:migrate is what creates the column.

class AddClearedBooleanToTrx < ActiveRecord::Migration[7.0]
  def change
    add_column :trxes, :cleared, :boolean, null: false, default: false
  end
  add_index :trxes, :cleared
end
  create_table "trxes", force: :cascade do |t|
    t.date "date", null: false
    t.integer "amount", default: 0, null: false
    t.string "memo"
    t.integer "account_id", null: false
    t.integer "category_id", null: false
    t.integer "vendor_id", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "cleared", default: false, null: false
    t.index ["account_id"], name: "index_trxes_on_account_id"
    t.index ["category_id"], name: "index_trxes_on_category_id"
    t.index ["cleared"], name: "index_trxes_on_cleared"
    t.index ["date"], name: "index_trxes_on_date"
    t.index ["vendor_id"], name: "index_trxes_on_vendor_id"
  end

My project repo: https://github.com/charleshug/moneyapp

chug
  • 71
  • 6

0 Answers0