marketing said over 3 years ago on Friend Requests From Scratch :
You need to edit the migration before you run it to add the references to the User table:

class CreateFriendships < ActiveRecord::Migration[6.0]
  def change
    create_table :friendships do |t|
      t.references :user, null: false, foreign_key: { to_table: :users }
      t.references :friend, null: false, foreign_key: { to_table: :users }
      t.integer :status, default: 0, limit: 1

      t.timestamps
    end
  end
end