Rails On_Delete Cascade nie działa

// dont do a foreing_key, instead use t.references
class CreateDocumentImages < ActiveRecord::Migration[5.1]
  def change
    create_table :document_images do |t|
      t.references :document, foreign_key: { on_delete: :cascade }
      t.references :image, foreign_key: { on_delete: :cascade}
      t.timestamps
    end
  end
end
Embarrassed Emu