class AddIndexForHackCodes < ActiveRecord::Migration[5.2] def change HackCode.destroy_all add_index :hack_codes, [:hack_id, :language], unique: true end end