SELECT IF(COUNT(*)=3,1,0) AS edge_tables FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND ENGINE='InnoDB' AND TABLE_NAME IN ('mdp_edge_device','mdp_edge_receipt','mdp_edge_api_rejected_page'); SELECT IF(GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX)='tenant_id,factory_id,dataset_id,source_id,active_slot',1,0) AS edge_exclusive_binding FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_edge_device' AND INDEX_NAME='uk_edge_binding' AND NON_UNIQUE=0; SELECT IF(COUNT(*)=3,1,0) AS edge_credential_uniqueness FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_edge_device' AND NON_UNIQUE=0 AND ((INDEX_NAME='uk_edge_activation' AND COLUMN_NAME='activation_hash') OR (INDEX_NAME='uk_edge_certificate' AND COLUMN_NAME='certificate_hash') OR (INDEX_NAME='uk_edge_pending_certificate' AND COLUMN_NAME='next_certificate_hash')); SELECT IF(COUNT(*)=1,1,0) AS edge_batch_once FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_edge_receipt' AND INDEX_NAME='PRIMARY' AND COLUMN_NAME='batch_id'; SELECT IF(GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX)='device_id,generation,position_hash',1,0) AS edge_recovery_position FROM information_schema.STATISTICS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='mdp_edge_api_rejected_page' AND INDEX_NAME='ix_edge_api_reject_position';