SELECT CASE WHEN COUNT(*) = 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_module_dashboard_rebuild_job';

SELECT CASE WHEN COUNT(*) = 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_mdp_rebuild_lock';

SELECT CASE WHEN COUNT(DISTINCT INDEX_NAME) = 3 THEN 1 ELSE 0 END AS ok
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_module_dashboard_rebuild_job'
  AND INDEX_NAME IN ('ix_mdp_rebuild_scope','ix_mdp_rebuild_status','ix_mdp_rebuild_heartbeat');

SELECT CASE WHEN COUNT(DISTINCT INDEX_NAME) = 2 THEN 1 ELSE 0 END AS ok
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_mdp_rebuild_lock'
  AND INDEX_NAME IN ('ix_mdp_rebuild_lock_scope','ix_mdp_rebuild_lock_heartbeat');
