]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1196] Fixed after migration cleanup
authorFrancis Dupont <fdupont@isc.org>
Thu, 18 Jun 2020 20:01:48 +0000 (22:01 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 19 Jun 2020 15:04:50 +0000 (17:04 +0200)
src/share/database/scripts/mysql/upgrade_9.1_to_9.2.sh.in

index c2a95daa08118e0281a5302ef94ca3235ab07a27..7d05d270e10add45c699c5a14046a52379a87ca0 100644 (file)
@@ -55,102 +55,6 @@ ALTER TABLE dhcp6_options ADD CONSTRAINT fk_dhcp6_options_pd_pool
         REFERENCES dhcp6_pd_pool(id)
         ON DELETE CASCADE ON UPDATE CASCADE;
 
-# Fix stat_lease4_update trigger
-DROP TRIGGER stat_lease4_update;
-
-DELIMITER $$
-CREATE TRIGGER stat_lease4_update AFTER UPDATE ON lease4
-    FOR EACH ROW
-    BEGIN
-        IF OLD.subnet_id != NEW.subnet_id OR OLD.state != NEW.state THEN
-            IF OLD.state = 0 OR OLD.state = 1 THEN
-                # Decrement the old state count if record exists
-                UPDATE lease4_stat
-                SET leases = IF(leases > 0, leases - 1, 0)
-                WHERE subnet_id = OLD.subnet_id AND state = OLD.state;
-            END IF;
-
-            IF NEW.state = 0 OR NEW.state = 1 THEN
-                # Increment the new state count if record exists
-                UPDATE lease4_stat SET leases = leases + 1
-                WHERE subnet_id = NEW.subnet_id AND state = NEW.state;
-
-                # Insert new state record if it does not exist
-                IF ROW_COUNT() <= 0 THEN
-                    INSERT INTO lease4_stat VALUES (NEW.subnet_id, NEW.state, 1);
-                END IF;
-            END IF;
-        END IF;
-    END $$
-DELIMITER ;
-
-# Fix stat_lease4_delete trigger
-DROP TRIGGER stat_lease4_delete;
-
-DELIMITER $$
-CREATE TRIGGER stat_lease4_delete AFTER DELETE ON lease4
-    FOR EACH ROW
-    BEGIN
-        IF OLD.state = 0 OR OLD.state = 1 THEN
-            # Decrement the state count if record exists
-            UPDATE lease4_stat
-            SET leases = IF(leases > 0, leases - 1, 0)
-            WHERE subnet_id = OLD.subnet_id AND OLD.state = state;
-        END IF;
-    END $$
-DELIMITER ;
-
-# Fix stat_lease6_update trigger
-DROP TRIGGER stat_lease6_update;
-
-DELIMITER $$
-CREATE TRIGGER stat_lease6_update AFTER UPDATE ON lease6
-    FOR EACH ROW
-    BEGIN
-        IF OLD.subnet_id != NEW.subnet_id OR
-           OLD.lease_type != NEW.lease_type OR
-           OLD.state != NEW.state THEN
-            IF OLD.state = 0 OR OLD.state = 1 THEN
-                # Decrement the old state count if record exists
-                UPDATE lease6_stat
-                SET leases = IF(leases > 0, leases - 1, 0)
-                WHERE subnet_id = OLD.subnet_id AND lease_type = OLD.lease_type
-                AND state = OLD.state;
-            END IF;
-
-            IF NEW.state = 0 OR NEW.state = 1 THEN
-                # Increment the new state count if record exists
-                UPDATE lease6_stat SET leases = leases + 1
-                WHERE subnet_id = NEW.subnet_id AND lease_type = NEW.lease_type
-                AND state = NEW.state;
-
-                # Insert new state record if it does not exist
-                IF ROW_COUNT() <= 0 THEN
-                    INSERT INTO lease6_stat
-                    VALUES (NEW.subnet_id, NEW.lease_type, NEW.state, 1);
-                END IF;
-            END IF;
-        END IF;
-    END $$
-DELIMITER ;
-
-# Fix stat_lease6_delete trigger
-DROP TRIGGER stat_lease6_delete;
-
-DELIMITER $$
-CREATE TRIGGER stat_lease6_delete AFTER DELETE ON lease6
-    FOR EACH ROW
-    BEGIN
-        IF OLD.state = 0 OR OLD.state = 1 THEN
-            # Decrement the state count if record exists
-            UPDATE lease6_stat
-            SET leases = IF(leases > 0, leases - 1, 0)
-            WHERE subnet_id = OLD.subnet_id AND lease_type = OLD.lease_type
-            AND state = OLD.state;
-        END IF;
-    END $$
-DELIMITER ;
-
 # Update the schema version number
 UPDATE schema_version
 SET version = '9', minor = '2';