-- =====================================================
-- ROLLBACK 05: Remove Compliance Infrastructure
-- =====================================================
-- Date: 2025-11-06
-- Purpose: Rollback script 05_create_compliance_infrastructure.sql
-- WARNING: This will DELETE all compliance data
-- =====================================================

USE shopdb;
SET SQL_SAFE_UPDATES = 0;

-- =====================================================
-- STEP 1: Drop views first
-- =====================================================

DROP VIEW IF EXISTS vw_compliance_summary;

-- =====================================================
-- STEP 2: Drop tables in correct order (FK constraints)
-- =====================================================

DROP TABLE IF EXISTS compliancescans;
DROP TABLE IF EXISTS compliance;

-- =====================================================
-- VERIFICATION
-- =====================================================

SELECT '✓ Compliance views dropped' AS status;
SELECT '✓ compliancescans table dropped' AS status;
SELECT '✓ compliance table dropped' AS status;
SELECT '✓ ROLLBACK 05 completed successfully' AS status;

SET SQL_SAFE_UPDATES = 1;

-- =====================================================
-- NOTES
-- =====================================================
-- Removed:
-- - compliance table
-- - compliancescans table
-- - vw_compliance_summary view
--
-- To restore: Run 05_create_compliance_infrastructure.sql
-- =====================================================
