From b31d75aa67d2b35127a5e23cc7145f4b4ba5f7e2 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 16 Feb 2021 20:35:31 +0000 Subject: [PATCH] Remove cost_price fields from database --- ..._remove_cost_price_from_variant_and_line_item.rb | 13 +++++++++++++ db/schema.rb | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20210216203057_remove_cost_price_from_variant_and_line_item.rb diff --git a/db/migrate/20210216203057_remove_cost_price_from_variant_and_line_item.rb b/db/migrate/20210216203057_remove_cost_price_from_variant_and_line_item.rb new file mode 100644 index 0000000000..5c9af2937c --- /dev/null +++ b/db/migrate/20210216203057_remove_cost_price_from_variant_and_line_item.rb @@ -0,0 +1,13 @@ +class RemoveCostPriceFromVariantAndLineItem < ActiveRecord::Migration + def up + remove_column :spree_variants, :cost_price + remove_column :spree_line_items, :cost_price + end + + def down + add_column :spree_variants, :cost_price, :decimal, + precision: 8, scale: 2 + add_column :spree_line_items, :cost_price, :integer, + precision: 8, scale: 2 + end +end diff --git a/db/schema.rb b/db/schema.rb index 9efd65d3e2..5fda055e80 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20210203215049) do +ActiveRecord::Schema.define(version: 20210216203057) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -504,7 +504,6 @@ ActiveRecord::Schema.define(version: 20210203215049) do t.string "currency", limit: 255 t.decimal "distribution_fee", precision: 10, scale: 2 t.decimal "final_weight_volume", precision: 10, scale: 2 - t.decimal "cost_price", precision: 10, scale: 2 t.integer "tax_category_id" end @@ -1069,7 +1068,6 @@ ActiveRecord::Schema.define(version: 20210203215049) do t.datetime "deleted_at" t.boolean "is_master", default: false t.integer "product_id" - t.decimal "cost_price", precision: 10, scale: 2 t.integer "position" t.string "cost_currency", limit: 255 t.float "unit_value", default: 1.0, null: false