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 nodeT -- ----------------------------------------------------- alter table nodeT add displayNode enum('n','y') not null default 'y' after isRoot; alter table nodeT add index displaynode_idx (displayNode asc); update nodeT n join nodeTypeT nt on n.nodeTypeId = nt.id set n.displayNode = nt.displayNode; -- ----------------------------------------------------- -- Table attributeT -- ----------------------------------------------------- alter table attributeT add sortable enum('n','y') not null default 'n' after required; alter table attributeT add index sortable_idx (sortable asc); alter table attributeT add code varchar(30) binary null after dataTypeId; alter table attributeT add unique index code_UNIQUE (code asc); -- ----------------------------------------------------- -- Table searchResultSortT -- ----------------------------------------------------- DROP TABLE IF EXISTS searchResultSortT ; CREATE TABLE IF NOT EXISTS searchResultSortT ( sessionId BIGINT UNSIGNED NOT NULL, nodeId INT UNSIGNED NOT NULL, attributeId INT UNSIGNED NOT NULL, sorter INT NOT NULL, PRIMARY KEY (sessionId, nodeId, attributeId), INDEX fk_searchResultSortT_attributeT1_idx (attributeId ASC), INDEX sorter_idx (sessionId ASC, attributeId ASC, sorter ASC), CONSTRAINT fk_searchResultSortT_searchResultT1 FOREIGN KEY (sessionId , nodeId) REFERENCES searchResultT (sessionId , nodeId) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT fk_searchResultSortT_attributeT1 FOREIGN KEY (attributeId) REFERENCES attributeT (id) ON DELETE CASCADE 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;