Created
March 31, 2023 12:56
-
-
Save remcotolsma/175e7423a2fc60248997d03000251fe8 to your computer and use it in GitHub Desktop.
Pronamic Pay database queries to change the last subscription phase amount.
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
SELECT | |
post.ID AS post_id, | |
post.post_date, | |
post.post_content->>'$.source.key' AS source_key, | |
-- The '200' value represents the new amount. | |
JSON_REPLACE( post.post_content, '$.phases[last].amount.value', '200' ) AS post_content | |
FROM | |
wp_posts AS post | |
WHERE | |
post.post_type = 'pronamic_pay_subscr' | |
AND | |
post.post_status = 'subscr_active' | |
AND | |
JSON_VALID( post.post_content ) | |
AND | |
post.post_content->>'$.source.key' = 'gravityformsideal' | |
AND | |
-- The '100' value represents the current amount. | |
post.post_content->>'$.phases[last].amount.value' = '100' | |
; |
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
UPDATE | |
wp_posts AS post | |
SET | |
-- The '200' value represents the new amount. | |
post.post_content = JSON_REPLACE( post.post_content, '$.phases[last].amount.value', '200' ) | |
WHERE | |
post.post_type = 'pronamic_pay_subscr' | |
AND | |
post.post_status = 'subscr_active' | |
AND | |
JSON_VALID( post.post_content ) | |
AND | |
post.post_content->>'$.source.key' = 'gravityformsideal' | |
AND | |
-- The '100' value represents the current amount. | |
post.post_content->>'$.phases[last].amount.value' = '100' | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment