-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7월 첫번째 배포 릴리즈 노트 참고
- Loading branch information
Showing
8 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class SetOrderedAtToOrderInfo < ActiveRecord::Migration[6.0] | ||
def up | ||
ApplicationRecord.country_context_with 'global' do | ||
OrderInfo.update_all('ordered_at=created_at') | ||
end | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
23 changes: 23 additions & 0 deletions
23
db/data/20200630093017_set_captured_prices_to_ordered_cart_items.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class SetCapturedPricesToOrderedCartItems < ActiveRecord::Migration[6.0] | ||
def up | ||
ApplicationRecord.country_context_with 'global' do | ||
OrderInfo.all.each do |order| | ||
order.items.each do |cart_item| | ||
timely_option = cart_item.product_option&.version_at(order.created_at) || ProductOption.zombie_find(cart_item.product_option_id)&.version_at(order.created_at) | ||
cart_item.update( | ||
captured_base_price: timely_option.base_price, | ||
captured_discount_price: timely_option.discount_price, | ||
captured_additional_price: timely_option.additional_price, | ||
captured_retail_price: timely_option.retail_price, | ||
captured_price_change: timely_option.price_change, | ||
captured: true | ||
) if timely_option | ||
end | ||
end | ||
end | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
db/migrate/20200630092452_rename_captured_price_columns_and_add_column_captured.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class RenameCapturedPriceColumnsAndAddColumnCaptured < ActiveRecord::Migration[6.0] | ||
def change | ||
add_prefix_to_captured_price_columns | ||
|
||
add_column :cart_items, :captured, :boolean, null: false, default: false | ||
end | ||
|
||
private | ||
|
||
def add_prefix_to_captured_price_columns | ||
rename_column :cart_items, :base_price, :captured_base_price | ||
rename_column :cart_items, :discount_price, :captured_discount_price | ||
rename_column :cart_items, :additional_price, :captured_additional_price | ||
rename_column :cart_items, :retail_price, :captured_retail_price | ||
rename_column :cart_items, :price_change, :captured_price_change | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
db/migrate/cart_item/20200630080410_add_columns_to_cart_items_for_captured_prices.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AddColumnsToCartItemsForCapturedPrices < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :cart_items, :base_price, :integer, null: false, default: 0 | ||
add_column :cart_items, :discount_price, :integer, null: false, default: 0 | ||
add_column :cart_items, :additional_price, :integer, null: false, default: 0 | ||
add_column :cart_items, :retail_price, :integer, null: false, default: 0 | ||
add_column :cart_items, :price_change, :integer, null: false, default: 0 | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/order_info/20200624093424_add_column_ordered_at_to_order_info.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddColumnOrderedAtToOrderInfo < ActiveRecord::Migration[6.0] | ||
def change | ||
add_column :order_infos, :ordered_at, :datetime | ||
end | ||
end |