
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;

-- ---------------------------------------------------------------------
-- rem_wdog
-- ---------------------------------------------------------------------

DROP TABLE IF EXISTS `rem_wdog`;

CREATE TABLE `rem_wdog`
(
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `mod` INTEGER NOT NULL,
    `name` VARCHAR(255) NOT NULL,
    `inst_addr_sel` INTEGER NOT NULL,
    `inst_addr_val` VARCHAR(255) NOT NULL,
    `evt_spec_sel` INTEGER NOT NULL,
    `evt_spec_val` VARCHAR(255) NOT NULL,
    `min_int` INTEGER NOT NULL,
    `last_ping` INTEGER NOT NULL,
    `has_alarm` TINYINT(1) NOT NULL,
    `inactive` TINYINT(1) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE INDEX `rem_wdog_U_1` (`inst_addr_sel`, `inst_addr_val`)
) ENGINE=InnoDB CHARACTER SET='utf8';

-- ---------------------------------------------------------------------
-- ping_wdog
-- ---------------------------------------------------------------------

DROP TABLE IF EXISTS `ping_wdog`;

CREATE TABLE `ping_wdog`
(
    `id` INTEGER NOT NULL AUTO_INCREMENT,
    `mod` INTEGER NOT NULL,
    `name` VARCHAR(255) NOT NULL,
    `inst_addr_sel` INTEGER NOT NULL,
    `inst_addr_val` VARCHAR(255) NOT NULL,
    `evt_spec_sel` INTEGER NOT NULL,
    `evt_spec_val` VARCHAR(255) NOT NULL,
    `has_alarm` TINYINT(1) NOT NULL,
    `inactive` TINYINT(1) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE INDEX `ping_wdog_U_1` (`inst_addr_sel`, `inst_addr_val`)
) ENGINE=InnoDB CHARACTER SET='utf8';

# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
