| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- -- Database synchronization, recovery and purchase row identity.
- SELECT IF((SELECT COUNT(*) FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name IN ('mdp_connector_relational_sync_run','mdp_connector_relational_sync_page'))=2, 1, 0);
- SELECT EXISTS(SELECT 1 FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_window') AS relational_sync_window;
- SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE()
- AND table_name='mdp_std_purchase_order_version') AS purchase_version;
- SELECT EXISTS(SELECT 1 FROM information_schema.tables WHERE table_schema=DATABASE()
- AND table_name='mdp_connector_relational_change_run') AS connector_proof;
- SELECT EXISTS(SELECT 1 FROM information_schema.views WHERE table_schema=DATABASE()
- AND table_name='mdp_std_purchase_order_active') AS active_purchase;
- SELECT EXISTS(SELECT 1 FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_time_window') AS relational_time_window;
- SELECT (SELECT COUNT(*) FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name IN ('mdp_connector_purchase_snapshot','mdp_connector_purchase_snapshot_key'))=2
- AS purchase_snapshot_scope;
- SELECT COUNT(*) = 2 AS relational_cutover_tables
- FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name IN
- ('mdp_connector_relational_schedule','mdp_connector_relational_sync_proof');
- SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index) = 'tenant_id,task_code' AS schedule_tenant_task_unique
- FROM information_schema.statistics
- WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_schedule'
- AND index_name='uk_relational_schedule_task' AND non_unique=0;
- SELECT COUNT(*)=1 AS sync_recovery_exists
- FROM information_schema.tables
- WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_recovery';
- SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='run_id,reason' AS sync_recovery_scope
- FROM information_schema.statistics
- WHERE table_schema=DATABASE() AND table_name='mdp_connector_relational_sync_recovery' AND index_name='PRIMARY';
- SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='tenant_id,factory_id,po_no,po_line' AS scoped_purchase_identity
- FROM information_schema.statistics WHERE table_schema=DATABASE()
- AND table_name='mdp_std_purchase_order' AND index_name='uk_po_line' AND non_unique=0;
- SELECT GROUP_CONCAT(COALESCE(column_name,'<expression>') ORDER BY seq_in_index)='tenant_id,<expression>,source_system,source_biz_key' AS scoped_purchase_source
- FROM information_schema.statistics WHERE table_schema=DATABASE()
- AND table_name='mdp_std_purchase_order' AND index_name='uk_source_key' AND non_unique=0;
- 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
- FROM information_schema.statistics WHERE table_schema=DATABASE()
- AND table_name='mdp_stg_purchase_order' AND index_name='uk_source_key' AND non_unique=0;
- SELECT COUNT(*)=1 AS active_delivery_view
- FROM information_schema.views WHERE table_schema=DATABASE() AND table_name='mdp_dwd_supplier_delivery_active';
- SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)='tenant_id,factory_id,po_no,po_line' AS scoped_purchase_completion
- FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='mdp_std_purchase_order_completion'
- AND index_name='uk_mdp_std_po_completion' AND non_unique=0;
- 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
- FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='dwd_s4_purchase_execution'
- AND index_name='uk_dwd_s4_pe' AND non_unique=0;
- SELECT GROUP_CONCAT(COALESCE(column_name,'<expression>') ORDER BY seq_in_index)='tenant_id,po_no,po_line,<expression>' AS unknown_factory_scope
- FROM information_schema.statistics WHERE table_schema=DATABASE() AND table_name='mdp_std_purchase_order'
- AND index_name='uk_po_unknown_factory' AND non_unique=0;
|