# Copyright (C) 2016-2024 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Turn off foreign key checks as CASCADE isn't really supported in MySQL
SET SESSION FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS lease4;
DROP TABLE IF EXISTS lease6;
DROP TABLE IF EXISTS lease6_types;
DROP TABLE IF EXISTS lease_hwaddr_source;
DROP TABLE IF EXISTS schema_version;
DROP TABLE IF EXISTS ipv6_reservations;
DROP TABLE IF EXISTS hosts;
DROP TABLE IF EXISTS dhcp4_options;
DROP TABLE IF EXISTS dhcp6_options;
DROP TABLE IF EXISTS host_identifier_type;
DROP TABLE IF EXISTS lease_state;
DROP TABLE IF EXISTS dhcp_option_scope;
DROP TRIGGER IF EXISTS host_BDEL;
DROP PROCEDURE IF EXISTS lease4DumpHeader;
DROP PROCEDURE IF EXISTS lease4DumpData;
DROP PROCEDURE IF EXISTS lease6DumpHeader;
DROP PROCEDURE IF EXISTS lease6DumpData;
DROP TRIGGER IF EXISTS stat_lease4_insert;
DROP TRIGGER IF EXISTS stat_lease4_update;
DROP TRIGGER IF EXISTS stat_lease4_delete;
DROP TABLE IF EXISTS lease4_stat;
DROP TABLE IF EXISTS lease4_pool_stat;
DROP TRIGGER IF EXISTS stat_lease6_insert;
DROP TRIGGER IF EXISTS stat_lease6_update;
DROP TRIGGER IF EXISTS stat_lease6_delete;
DROP TABLE IF EXISTS lease6_stat;
DROP TABLE IF EXISTS lease6_pool_stat;
DROP TABLE IF EXISTS logs;
DROP TABLE IF EXISTS dhcp4_audit;
DROP TABLE IF EXISTS dhcp4_audit_revision;
DROP TABLE IF EXISTS dhcp4_global_parameter;
DROP TABLE IF EXISTS dhcp4_global_parameter_server;
DROP TABLE IF EXISTS dhcp4_option_def;
DROP TABLE IF EXISTS dhcp4_option_def_server;
DROP TABLE IF EXISTS dhcp4_options_server;
DROP TABLE IF EXISTS dhcp4_pool;
DROP TABLE IF EXISTS dhcp4_server;
DROP TABLE IF EXISTS dhcp4_shared_network;
DROP TABLE IF EXISTS dhcp4_shared_network_server;
DROP TABLE IF EXISTS dhcp4_subnet;
DROP TABLE IF EXISTS dhcp4_subnet_server;
DROP TABLE IF EXISTS dhcp4_client_class;
DROP TABLE IF EXISTS dhcp4_client_class_order;
DROP TABLE IF EXISTS dhcp4_client_class_dependency;
DROP TABLE IF EXISTS dhcp4_client_class_server;
DROP TABLE IF EXISTS dhcp6_audit;
DROP TABLE IF EXISTS dhcp6_global_parameter;
DROP TABLE IF EXISTS dhcp6_global_parameter_server;
DROP TABLE IF EXISTS dhcp6_option_def;
DROP TABLE IF EXISTS dhcp6_option_def_server;
DROP TABLE IF EXISTS dhcp6_options_server;
DROP TABLE IF EXISTS dhcp6_pd_pool;
DROP TABLE IF EXISTS dhcp6_pool;
DROP TABLE IF EXISTS dhcp6_server;
DROP TABLE IF EXISTS dhcp6_shared_network;
DROP TABLE IF EXISTS dhcp6_shared_network_server;
DROP TABLE IF EXISTS dhcp6_subnet;
DROP TABLE IF EXISTS dhcp6_subnet_server;
DROP TABLE IF EXISTS dhcp6_client_class;
DROP TABLE IF EXISTS dhcp6_client_class_order;
DROP TABLE IF EXISTS dhcp6_client_class_dependency;
DROP TABLE IF EXISTS dhcp6_client_class_server;
DROP TABLE IF EXISTS modification;
DROP TABLE IF EXISTS parameter_data_type;
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP4;
DROP PROCEDURE IF EXISTS createAuditEntryDHCP4;
DROP PROCEDURE IF EXISTS createOptionAuditDHCP4;
DROP PROCEDURE IF EXISTS setClientClass4Order;
DROP PROCEDURE IF EXISTS checkDHCPv4ClientClassDependency;
DROP PROCEDURE IF EXISTS updateDHCPv4ClientClassKnownDependency;
DROP PROCEDURE IF EXISTS checkDHCPv4ClientClassKnownDependencyChange;
DROP TRIGGER IF EXISTS dhcp4_global_parameter_AINS;
DROP TRIGGER IF EXISTS dhcp4_global_parameter_AUPD;
DROP TRIGGER IF EXISTS dhcp4_global_parameter_ADEL;
DROP TRIGGER IF EXISTS dhcp4_subnet_AINS;
DROP TRIGGER IF EXISTS dhcp4_subnet_AUPD;
DROP TRIGGER IF EXISTS dhcp4_subnet_ADEL;
DROP TRIGGER IF EXISTS dhcp4_shared_network_AINS;
DROP TRIGGER IF EXISTS dhcp4_shared_network_AUPD;
DROP TRIGGER IF EXISTS dhcp4_shared_network_ADEL;
DROP TRIGGER IF EXISTS dhcp4_option_def_AINS;
DROP TRIGGER IF EXISTS dhcp4_option_def_AUPD;
DROP TRIGGER IF EXISTS dhcp4_option_def_ADEL;
DROP TRIGGER IF EXISTS dhcp4_options_AINS;
DROP TRIGGER IF EXISTS dhcp4_options_AUPD;
DROP TRIGGER IF EXISTS dhcp4_options_ADEL;
DROP TRIGGER IF EXISTS dhcp4_client_class_AINS;
DROP TRIGGER IF EXISTS dhcp4_client_class_AUPD;
DROP TRIGGER IF EXISTS dhcp4_client_class_ADEL;
DROP TRIGGER IF EXISTS dhcp4_client_class_dependency_BINS;
DROP TRIGGER IF EXISTS dhcp4_client_class_dependency_AINS;
DROP TABLE IF EXISTS dhcp6_audit_revision;
DROP PROCEDURE IF EXISTS createAuditRevisionDHCP6;
DROP PROCEDURE IF EXISTS createAuditEntryDHCP6;
DROP PROCEDURE IF EXISTS createOptionAuditDHCP6;
DROP PROCEDURE IF EXISTS setClientClass6Order;
DROP PROCEDURE IF EXISTS checkDHCPv6ClientClassDependency;
DROP PROCEDURE IF EXISTS updateDHCPv6ClientClassKnownDependency;
DROP PROCEDURE IF EXISTS checkDHCPv6ClientClassKnownDependencyChange;
DROP TRIGGER IF EXISTS dhcp6_global_parameter_AINS;
DROP TRIGGER IF EXISTS dhcp6_global_parameter_AUPD;
DROP TRIGGER IF EXISTS dhcp6_global_parameter_ADEL;
DROP TRIGGER IF EXISTS dhcp6_subnet_AINS;
DROP TRIGGER IF EXISTS dhcp6_subnet_AUPD;
DROP TRIGGER IF EXISTS dhcp6_subnet_ADEL;
DROP TRIGGER IF EXISTS dhcp6_shared_network_AINS;
DROP TRIGGER IF EXISTS dhcp6_shared_network_AUPD;
DROP TRIGGER IF EXISTS dhcp6_shared_network_ADEL;
DROP TRIGGER IF EXISTS dhcp6_option_def_AINS;
DROP TRIGGER IF EXISTS dhcp6_option_def_AUPD;
DROP TRIGGER IF EXISTS dhcp6_option_def_ADEL;
DROP TRIGGER IF EXISTS dhcp6_options_AINS;
DROP TRIGGER IF EXISTS dhcp6_options_AUPD;
DROP TRIGGER IF EXISTS dhcp6_options_ADEL;
DROP TRIGGER IF EXISTS dhcp6_client_class_AINS;
DROP TRIGGER IF EXISTS dhcp6_client_class_AUPD;
DROP TRIGGER IF EXISTS dhcp6_client_class_ADEL;
DROP TRIGGER IF EXISTS dhcp6_client_class_dependency_BINS;
DROP TRIGGER IF EXISTS dhcp6_client_class_dependency_AINS;
DROP FUNCTION IF EXISTS colonSeparatedHex;
DROP PROCEDURE IF EXISTS lease4Upload;
DROP PROCEDURE IF EXISTS lease6Upload;
DROP TRIGGER IF EXISTS dhcp4_shared_network_BDEL;
DROP TRIGGER IF EXISTS dhcp6_shared_network_BDEL;
DROP PROCEDURE IF EXISTS lease4_AINS_lease4_stat;
DROP PROCEDURE IF EXISTS lease4_AUPD_lease4_stat;
DROP PROCEDURE IF EXISTS lease4_ADEL_lease4_stat;
DROP PROCEDURE IF EXISTS lease6_AINS_lease6_stat;
DROP PROCEDURE IF EXISTS lease6_AUPD_lease6_stat;
DROP PROCEDURE IF EXISTS lease6_ADEL_lease6_stat;
DROP PROCEDURE IF EXISTS lease4_AINS_lease4_pool_stat;
DROP PROCEDURE IF EXISTS lease4_AUPD_lease4_pool_stat;
DROP PROCEDURE IF EXISTS lease4_ADEL_lease4_pool_stat;
DROP PROCEDURE IF EXISTS lease6_AINS_lease6_pool_stat;
DROP PROCEDURE IF EXISTS lease6_AUPD_lease6_pool_stat;
DROP PROCEDURE IF EXISTS lease6_ADEL_lease6_pool_stat;
DROP TABLE IF EXISTS lease4_stat_by_client_class;
DROP TABLE IF EXISTS lease6_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease4_AINS_lease4_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease4_AUPD_lease4_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease4_ADEL_lease4_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease6_AINS_lease6_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease6_AUPD_lease6_stat_by_client_class;
DROP PROCEDURE IF EXISTS lease6_ADEL_lease6_stat_by_client_class;
DROP TRIGGER IF EXISTS lease4_AINS;
DROP TRIGGER IF EXISTS lease4_AUPD;
DROP TRIGGER IF EXISTS lease4_ADEL;
DROP TRIGGER IF EXISTS lease6_AINS;
DROP TRIGGER IF EXISTS lease6_AUPD;
DROP TRIGGER IF EXISTS lease6_ADEL;
DROP FUNCTION IF EXISTS checkLease4Limits;
DROP FUNCTION IF EXISTS checkLease6Limits;
DROP FUNCTION IF EXISTS isJsonSupported;
DROP TABLE IF EXISTS lease6_relay_id;
DROP TABLE IF EXISTS lease6_remote_id;
DROP TABLE IF EXISTS option_def_data_type;
