Last active
August 8, 2020 22:45
-
-
Save byaussy/8b65b0e46082d235c4342309fd2f0c43 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- billing rules | |
DELETE FROM billing_rules WHERE created_username = 'dm-batch-import'; | |
DELETE FROM billing_rule_groups WHERE created_username = 'dm-batch-import'; | |
SELECT setval(pg_get_serial_sequence('billing_rule_groups', 'id'), | |
(SELECT GREATEST(max(billing_rule_groups.id) + 1, 1000) FROM billing_rule_groups) , | |
false); | |
SELECT setval(pg_get_serial_sequence('billing_rules', 'id'), | |
(SELECT GREATEST(max(billing_rules.id) + 1, 1000) FROM billing_rules) , | |
false); | |
SELECT setval(pg_get_serial_sequence('custom_fee', 'id'), | |
(SELECT GREATEST(max(custom_fee.id) + 1, 1000) FROM custom_fee) , | |
false); | |
-- billing profiles | |
DELETE FROM billing_preferences WHERE created_by = 'dm-batch-import'; | |
DELETE FROM billing_profiles bp where id not in (select billing_profile_id as id from billing_preferences ); | |
SELECT setval(pg_get_serial_sequence('billing_profiles', 'id'), | |
(SELECT GREATEST(max(billing_profiles.id) + 1, 1000) FROM billing_profiles) , | |
false); | |
SELECT setval(pg_get_serial_sequence('billing_preferences', 'id'), | |
(SELECT GREATEST(max(billing_preferences.id) + 1, 1000) FROM billing_preferences) , | |
false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment