WordPress plugin: MailPoet

WordPress plugin: MailPoet

MailPoet on GitHub: https://github.com/mailpoet/mailpoet

Clean database after uninstalling MailPoet plugin

-- set table schema and pattern matching tables
SET @schema = 'bitnami_wordpress';
SET @pattern = 'wp_mailpoet_%';

-- build dynamic sql (DROP TABLE tbl1, tbl2...;)
SELECT CONCAT('DROP TABLE ',GROUP_CONCAT(CONCAT(@schema,'.',table_name)),';')
INTO @droplike
FROM information_schema.tables
WHERE @schema = database()
AND table_name LIKE @pattern;

-- display the dynamic sql statement
SELECT @droplike;

-- execute dynamic sql
PREPARE stmt FROM @droplike;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;