Delete preferences and adjustments related to account invoices

This commit is contained in:
luisramos0
2019-02-21 13:26:46 +00:00
parent 36e2786a1e
commit a870299ced
3 changed files with 37 additions and 4 deletions

View File

@@ -0,0 +1,22 @@
class DeleteAccountInvoicesPreferences < ActiveRecord::Migration
def up
Spree::Preference
.where( key: ['spree/app_configuration/accounts_distributor_id',
'spree/app_configuration/default_accounts_payment_method_id',
'spree/app_configuration/default_accounts_shipping_method_id',
'spree/app_configuration/auto_update_invoices',
'spree/app_configuration/auto_finalize_invoices',
'spree/app_configuration/account_invoices_monthly_fixed',
'spree/app_configuration/account_invoices_monthly_rate',
'spree/app_configuration/account_invoices_monthly_cap',
'spree/app_configuration/account_invoices_tax_rate',
'spree/app_configuration/shop_trial_length_days',
'spree/app_configuration/minimum_billable_turnover'])
.destroy_all
end
def down
# If these preferences are re-added to app/models/spree/app_configuration_decorator.rb
# these DB entries will be regenerated
end
end

View File

@@ -0,0 +1,11 @@
class DeleteAccountInvoicesAdjustments < ActiveRecord::Migration
def up
Spree::Adjustment
.where(:source_type => 'BillablePeriod')
.destroy_all
end
def down
# This data does not need to be recovered
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20181128054803) do
ActiveRecord::Schema.define(:version => 20190221131741) do
create_table "account_invoices", :force => true do |t|
t.integer "user_id", :null => false
@@ -533,9 +533,9 @@ ActiveRecord::Schema.define(:version => 20181128054803) do
t.datetime "updated_at", :null => false
t.integer "max_quantity"
t.string "currency"
t.decimal "distribution_fee", :precision => 10, :scale => 2
t.decimal "final_weight_volume", :precision => 10, :scale => 2
t.decimal "cost_price", :precision => 8, :scale => 2
t.decimal "distribution_fee", :precision => 10, :scale => 2
t.decimal "final_weight_volume", :precision => 10, :scale => 2
t.decimal "cost_price", :precision => 8, :scale => 2
t.integer "tax_category_id"
end