SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Table `imageT` -- ----------------------------------------------------- DROP TABLE IF EXISTS `imageT` ; CREATE TABLE IF NOT EXISTS `imageT` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `nodeId` INT UNSIGNED NULL, `forceSinglePhoto` ENUM('y') NULL, `name` VARCHAR(255) NOT NULL, `filenameOriginal` VARCHAR(255) NOT NULL, `filenameFs` VARCHAR(255) NOT NULL, `display` ENUM('n','y') NOT NULL DEFAULT 'y', `sorter` INT NOT NULL, `added` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', `changed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX `objectIdSorter_idx` (`nodeId` ASC, `display` ASC, `sorter` ASC), UNIQUE INDEX `nodeid_forcesinglephoto_uq` (`nodeId` ASC, `forceSinglePhoto` ASC), INDEX `sorter_idx` (`nodeId` ASC, `sorter` ASC), CONSTRAINT `fk_imageT_nodeT1` FOREIGN KEY (`nodeId` , `forceSinglePhoto`) REFERENCES `nodeT` (`id` , `forceSinglePhoto`) ON DELETE SET NULL ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;