add acts_as_paranoid to voucher

This is so the relation
`belongs_to :originator, -> { with_deleted }, polymorphic: true`
setup in Spree::Adjustement works as expected.
This commit is contained in:
Gaetan Craig-Riou
2023-03-20 13:45:42 +11:00
committed by Maikel Linke
parent a9d9b33f7d
commit b6213b25e9
3 changed files with 10 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
# frozen_string_literal: false
class Voucher < ApplicationRecord
acts_as_paranoid
include CalculatedAdjustments
belongs_to :enterprise

View File

@@ -0,0 +1,6 @@
class AddDeletedAtToVouchers < ActiveRecord::Migration[6.1]
def change
add_column :vouchers, :deleted_at, :datetime
add_index :vouchers, :deleted_at
end
end

View File

@@ -1196,7 +1196,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_24_141213) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "enterprise_id"
t.datetime "deleted_at"
t.index ["code", "enterprise_id"], name: "index_vouchers_on_code_and_enterprise_id", unique: true
t.index ["deleted_at"], name: "index_vouchers_on_deleted_at"
t.index ["enterprise_id"], name: "index_vouchers_on_enterprise_id"
end