Skip to content

Instantly share code, notes, and snippets.

@h4ckm03d
Last active June 26, 2024 03:52
Show Gist options
  • Save h4ckm03d/65b9b5e3d038dc7e0c39b8b26c049cef to your computer and use it in GitHub Desktop.
Save h4ckm03d/65b9b5e3d038dc7e0c39b8b26c049cef to your computer and use it in GitHub Desktop.
makro campaign
------------------
-- Rules
------------------
select *
from rules
where rule_name in (
'Early_Bird_7.7_3Jul_6Jul24'
);
----------------
INSERT INTO public.rules (
active, --1
rule_name, --2
rule_type, --3
calculation_type, --4
start_date, --5
end_date, --6
include_sku, --7
exclude_sku, --8
include_supplier, --9
exclude_supplier, --10
include_uda, --11
include_stores, --12
include_channels, --13
include_customer, --14
exclude_customer, --15
exclude_stores, --16
included_product_class, --17
exclude_product_class, --18
max_cap, --19
min_cap, --20
is_limit_once_per_customer, --21
minimum_sales_amount, --22
max_cap_per_customer, --23
campaign_name, --24
campaign_name_th, --25
campaign_mechanic, --26
campaign_mechanic_th, --27
makro_mailer, --28
campaign_budget, --29
estimation_close_threshold, --30
campaign_group_id, --31
include_customer_by_attrs, --32
include_payment_method, --33
exclude_payment_method, --34
time_slots, --35
include_payment_details, --36
include_additional_sku, --37
redemptions_per_customer, --38
point_source, --39
party_info --40
)
VALUES
(
true, --1. active
'Early_Bird_7.7_3Jul_6Jul24', --2. rule_name
'ORDER_ITEMS_AMOUNT', --3. rule_type
'{"type": "TIERED", "condition": [{"when": 4500, "points": 20}, {"when": 5000, "points": 25}, {"when": 6000, "points": 30}, {"when": 7000, "points": 49}]}'::jsonb, --4. calculation_type
'2024-07-03', --5. start_date
'2024-07-06', --6. end_date
NULL, --7. include_sku
NULL, --8. exclude_sku null
NULL, --9. include_supplier
NULL, --10. exclude_supplier
NULL, -- 11. include_uda
NULL, -- 12. include_stores
'{Maknet,MAKNET}', -- 13. include_channels
NULL, --14. include_customer
NULL, --15. exclude_customer
NULL, --16. exclude_stores
NULL, --17. included_product_class
NULL, --18. exclude_product_class
NULL, --19. max_cap
NULL, --20. min_cap
false, --21. is_limit_once_per_customer
NULL, --22. minimum_sales_amount
50, --23. max_cap_per_customer
'Early Bird 7.7: Get Extra 50 Points when purchase min. ฿4500 max 50 Points', --24. campaign_name
'', --25. campaign_name_th
'Early Bird 7.7: Get Extra 50 Points when purchase min. ฿4500 max 50 Points', --26. campaign_mechanic
'', --27.
NULL, --28. makro_mailer
NULL, --29. campaign_budget
NULL, --30. estimation_close_threshold
NULL, --31. campaign_group_id
NULL, --32. include_customer_by_attrs
NULL, --33. include_payment_method
NULL, --34. exclude_payment_method
NULL, --35. time_slots
NULL, --36. include_payment_details
NULL, --37. include_additional_sku
NULL, --38. redemptions_per_customer
2, --39. point source
'1P' --40. party_info
);
----------------
-- Rollback
----------------
delete from rules
where rule_name = 'Early_Bird_7.7_3Jul_6Jul24';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment