Skip to content

Commit

Permalink
fix: update referral_set_stats migration to use proper json fields
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Letang <[email protected]>
  • Loading branch information
jeremyletang committed Aug 12, 2024
1 parent bc366bd commit 2995e01
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ alter table referral_set_stats
alter table referral_set_stats
add column rewards_factors_multiplier jsonb;

update referral_set_stats set reward_factors = json_build_object('rewardInfraFactor', reward_factor, 'rewardMakerFactor', reward_factor, 'rewardLiquidityFactor', reward_factor);
update referral_set_stats set rewards_factors_multiplier = json_build_object('rewardInfraFactor', rewards_factor_multiplier, 'rewardMakerFactor', rewards_factor_multiplier, 'rewardLiquidityFactor', rewards_factor_multiplier);
update referral_set_stats set reward_factors = json_build_object('infrastructure_reward_factor', reward_factor, 'maker_reward_factor', reward_factor, 'liquidity_reward_factor', reward_factor);
update referral_set_stats set rewards_factors_multiplier = json_build_object('infrastructure_reward_factor', rewards_factor_multiplier, 'maker_reward_factor', rewards_factor_multiplier, 'liquidity_reward_factor', rewards_factor_multiplier);

UPDATE volume_discount_stats
SET parties_volume_discount_stats = (
Expand Down Expand Up @@ -93,8 +93,8 @@ alter table referral_set_stats
alter table referral_set_stats
add column rewards_factor_multiplier text not null default '0';

update referral_set_stats set reward_factor = 'reward_factor->rewardInfraFactor';
update referral_set_stats set rewards_factor_multiplier = 'rewards_factors_multiplier->rewardInfraFactor';
update referral_set_stats set reward_factor = 'reward_factor->infrastructure_reward_factor';
update referral_set_stats set rewards_factor_multiplier = 'rewards_factors_multiplier->infrastructure_reward_factor';

alter table referral_set_stats DROP COLUMN reward_factors;
alter table referral_set_stats DROP COLUMN rewards_factors_multiplier;
Expand All @@ -104,4 +104,4 @@ alter table trades DROP COLUMN buyer_buy_back_fee,
DROP COLUMN seller_buy_back_fee,
DROP COLUMN seller_treasury_fee,
DROP COLUMN buyer_high_volume_maker_fee,
DROP COLUMN seller_high_volume_maker_fee;
DROP COLUMN seller_high_volume_maker_fee;

0 comments on commit 2995e01

Please sign in to comment.