-- =====================================================
-- ROLLBACK 04: Remove Warranty Infrastructure
-- =====================================================
-- Date: 2025-11-06
-- Purpose: Rollback script 04_create_warranty_infrastructure.sql
-- WARNING: This will DELETE all warranty data
-- =====================================================

USE shopdb;
SET SQL_SAFE_UPDATES = 0;

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

DROP VIEW IF EXISTS vw_warranties_expiring;
DROP VIEW IF EXISTS vw_warranty_status;

-- =====================================================
-- STEP 2: Drop warranties table
-- =====================================================

DROP TABLE IF EXISTS warranties;

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

SELECT '✓ Warranty views dropped' AS status;
SELECT '✓ warranties table dropped' AS status;
SELECT '✓ ROLLBACK 04 completed successfully' AS status;

SET SQL_SAFE_UPDATES = 1;

-- =====================================================
-- NOTES
-- =====================================================
-- Removed:
-- - warranties table
-- - vw_warranty_status view
-- - vw_warranties_expiring view
--
-- To restore: Run 04_create_warranty_infrastructure.sql
-- =====================================================
