Episodes
liam said about 1 year ago on Friend Requests From Scratch :
 Here's my relevant schema code:
create_table "connections", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "contact_id", null: false
    t.integer "status", limit: 1, default: 0
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.index ["contact_id"], name: "index_connections_on_contact_id"
    t.index ["user_id"], name: "index_connections_on_user_id"
  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.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
    t.boolean "admin", default: 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

  add_foreign_key "connections", "contacts"
  add_foreign_key "connections", "users"
end

and the connections migration, if it helps:

class CreateConnections < ActiveRecord::Migration[6.1]
  def change
    create_table :connections do |t|
      t.references :user, null: false, foreign_key: { to_table: :users}
      t.references :contact, null: false, foreign_key: {to_table: :users}
      t.integer :status, default: 0, limit: 1

      t.timestamps
    end
  end
end

I tried to edit the migration as above based on comments made by marketing. I just directly edited the file, I wasn't sure if I needed to run a new migration. From what I've read on stack overflow and other places, the error I'm getting seems to be something to do with the migrations.