-- Cleanup script for RateController Integration Tests
-- (RateControllerIntegrationTest.java)

-- Delete in reverse order of foreign key dependencies

-- Delete system properties
DELETE FROM system_property WHERE property_set_id IN (1, 2);

-- Delete system property types
DELETE FROM system_property_type WHERE id IN (1, 2, 3);

-- Delete property sets
DELETE FROM property_set WHERE id IN (1, 2);

-- Delete country matrix rates
DELETE FROM country_matrix_rate WHERE validity_period_id IN (1, 2, 3, 4);

-- Delete container rates
DELETE FROM container_rate WHERE validity_period_id IN (1, 2, 3, 4);

-- Delete validity periods
DELETE FROM validity_period WHERE id IN (1, 2, 3, 4);

-- Delete nodes
DELETE FROM node WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8);

-- Delete countries
DELETE FROM country WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8);

-- Reset auto-increment counters if needed (optional)
ALTER TABLE country AUTO_INCREMENT = 1;
ALTER TABLE node AUTO_INCREMENT = 1;
ALTER TABLE validity_period AUTO_INCREMENT = 1;
ALTER TABLE container_rate AUTO_INCREMENT = 1;
ALTER TABLE country_matrix_rate AUTO_INCREMENT = 1;
ALTER TABLE property_set AUTO_INCREMENT = 1;
ALTER TABLE system_property_type AUTO_INCREMENT = 1;
ALTER TABLE system_property AUTO_INCREMENT = 1;