Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Last active December 26, 2015 23:29
Show Gist options
  • Save remcotolsma/7230462 to your computer and use it in GitHub Desktop.
Save remcotolsma/7230462 to your computer and use it in GitHub Desktop.
Pronamic iDEAL version 2.0 fix double payments conversion to custom post type.
-- Delete payments post meta lower then specific post ID
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'pronamic_payment' AND post_date <= '2013-11-14 15:34:26' );
-- Delete payments posts lower then specific post ID
DELETE FROM wp_posts WHERE post_type = 'pronamic_payment' AND post_date <= '2013-11-14 15:34:26';
-- Update the payments post ID reference
UPDATE wp_pronamic_ideal_payments SET post_id = null WHERE post_id NOT IN ( SELECT ID FROM wp_posts );
-- Reset the database version option
UPDATE wp_options SET option_value = 0 WHERE option_name = 'pronamic_pay_db_version';
-- Count payments to convert
SELECT COUNT( id ) FROM wp_pronamic_ideal_payments WHERE post_id IS NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment