1.0.619.verify.sql 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. -- Database synchronization, recovery and purchase row identity.
  2. SELECT IF((SELECT COUNT(*) FROM information_schema.tables
  3. WHERE table_schema=DATABASE() AND table_name IN ('mdp_connector_relational_sync_run','mdp_connector_relational_sync_page'))=2, 1, 0);
  4. SELECT EXISTS(SELECT 1 FROM information_schema.tables
  5. WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_window') AS relational_sync_window;
  6. SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE()
  7. AND table_name='mdp_std_purchase_order_version') AS purchase_version;
  8. SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE()
  9. AND table_name='mdp_connector_relational_change_run') AS connector_proof;
  10. SELECT EXISTS(SELECT 1 FROM information_schema.views WHERE table_schema=DATABASE()
  11. AND table_name='mdp_std_purchase_order_active') AS active_purchase;
  12. SELECT EXISTS(SELECT 1 FROM information_schema.tables
  13. WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_time_window') AS relational_time_window;
  14. SELECT (SELECT COUNT(*) FROM information_schema.tables
  15. WHERE table_schema=DATABASE() AND table_name IN ('mdp_connector_purchase_snapshot','mdp_connector_purchase_snapshot_key'))=2
  16. AS purchase_snapshot_scope;
  17. SELECT COUNT(*) = 2 AS relational_cutover_tables
  18. FROM information_schema.tables
  19. WHERE table_schema=DATABASE() AND table_name IN
  20. ('mdp_connector_relational_schedule','mdp_connector_relational_sync_proof');
  21. SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index) = 'tenant_id,task_code' AS schedule_tenant_task_unique
  22. FROM information_schema.statistics
  23. WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_schedule'
  24. AND index_name='uk_relational_schedule_task' AND non_unique=0;
  25. SELECT COUNT(*)=1 AS sync_recovery_exists
  26. FROM information_schema.tables
  27. WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_recovery';
  28. SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='run_id,reason' AS sync_recovery_scope
  29. FROM information_schema.statistics
  30. WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_recovery' AND index_name='PRIMARY';
  31. SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='tenant_id,factory_id,po_no,po_line' AS scoped_purchase_identity
  32. FROM information_schema.statistics WHERE table_schema=DATABASE()
  33. AND table_name='mdp_std_purchase_order' AND index_name='uk_po_line' AND non_unique=0;
  34. SELECT GROUP_CONCAT(COALESCE(column_name,'<expression>') ORDER BY seq_in_index)='tenant_id,<expression>,source_system,source_biz_key' AS scoped_purchase_source
  35. FROM information_schema.statistics WHERE table_schema=DATABASE()
  36. AND table_name='mdp_std_purchase_order' AND index_name='uk_source_key' AND non_unique=0;
  37. SELECT GROUP_CONCAT(COALESCE(column_name,'<expression>') ORDER BY seq_in_index)='<expression>,<expression>,source_system,source_table,source_biz_key' AS scoped_purchase_staging
  38. FROM information_schema.statistics WHERE table_schema=DATABASE()
  39. AND table_name='mdp_stg_purchase_order' AND index_name='uk_source_key' AND non_unique=0;
  40. SELECT COUNT(*)=1 AS active_delivery_view
  41. FROM information_schema.views WHERE table_schema=DATABASE() AND table_name='mdp_dwd_supplier_delivery_active';
  42. SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='tenant_id,factory_id,po_no,po_line' AS scoped_purchase_completion
  43. FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='mdp_std_purchase_order_completion'
  44. AND index_name='uk_mdp_std_po_completion' AND non_unique=0;
  45. SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='tenant_id,factory_id,stat_date,po_no,po_line,item_code' AS scoped_purchase_execution
  46. FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='dwd_s4_purchase_execution'
  47. AND index_name='uk_dwd_s4_pe' AND non_unique=0;
  48. SELECT GROUP_CONCAT(COALESCE(column_name,'<expression>') ORDER BY seq_in_index)='tenant_id,po_no,po_line,<expression>' AS unknown_factory_scope
  49. FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='mdp_std_purchase_order'
  50. AND index_name='uk_po_unknown_factory' AND non_unique=0;