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

SELECT CASE WHEN COUNT(*) = 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_smart_ops_kpi_target_config'
  AND INDEX_NAME = 'uk_kpi_target_start'
  AND NON_UNIQUE = 0;

SELECT CASE WHEN COUNT(*) >= 1 THEN 1 ELSE 0 END AS ok
FROM information_schema.STATISTICS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'ado_smart_ops_kpi_target_config'
  AND INDEX_NAME = 'ix_kpi_target_resolve';

SELECT CASE WHEN COUNT(*) = 4 THEN 1 ELSE 0 END AS ok
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME IN ('ado_s9_kpi_value_l1_day','ado_s9_kpi_value_l2_day','ado_s9_kpi_value_l3_day','ado_s9_kpi_value_l4_day')
  AND COLUMN_NAME = 'target_config_id';

SELECT CASE WHEN COUNT(*) = 3 THEN 1 ELSE 0 END AS ok
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME IN ('mdp_file_import_batch','mdp_file_import_row','mdp_file_import_error');

SELECT CASE WHEN COUNT(*) = 2 THEN 1 ELSE 0 END AS ok
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'mdp_entity'
  AND COLUMN_NAME IN ('file_config_json','is_public_template');
