mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Soft-delete enterprise fees
These objects can hold critical information related to adjustments and tax categories. If they are hard-deleted we lose vital data that's needed by associated records.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
class EnterpriseFee < ActiveRecord::Base
|
||||
include Spree::Core::CalculatedAdjustments
|
||||
|
||||
acts_as_paranoid
|
||||
|
||||
belongs_to :enterprise
|
||||
belongs_to :tax_category, class_name: 'Spree::TaxCategory', foreign_key: 'tax_category_id'
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddDeletedAtToEnterpriseFee < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :enterprise_fees, :deleted_at, :datetime
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20201219120055) do
|
||||
ActiveRecord::Schema.define(version: 20210115143738) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -108,6 +108,7 @@ ActiveRecord::Schema.define(version: 20201219120055) do
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "tax_category_id"
|
||||
t.boolean "inherits_tax_category", default: false, null: false
|
||||
t.datetime "deleted_at"
|
||||
end
|
||||
|
||||
add_index "enterprise_fees", ["enterprise_id"], name: "index_enterprise_fees_on_enterprise_id", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user