-- MySQL Script generated by MySQL Workbench -- Fri 17 Jul 2015 05:39:08 PM EEST -- Model: New Model Version: 1.0 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'; -- ----------------------------------------------------- -- Schema mydb -- ----------------------------------------------------- -- ----------------------------------------------------- -- Table `zzzNodeWorksetT` -- ----------------------------------------------------- DROP TABLE IF EXISTS `zzzNodeWorksetT` ; CREATE TABLE IF NOT EXISTS `zzzNodeWorksetT` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `connId` BIGINT UNSIGNED NOT NULL, `nodeId` INT UNSIGNED NOT NULL, `isMain` INT NOT NULL DEFAULT 1, `isExact` INT NOT NULL DEFAULT 0 COMMENT '0 - not exact node' /* comment truncated */ /*1 - exactly dest or indifferent 2 - exactly src*/, `added` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX `added_idx` (`added` ASC), INDEX `connid_nodeid_ismain_idx` (`connId` ASC, `nodeId` ASC, `isMain` ASC), INDEX `ismain_idx` (`isMain` ASC), UNIQUE INDEX `nodeid_connid_uq` (`nodeId` ASC, `connId` ASC), INDEX `connid_isexact_idx` (`connId` ASC, `isExact` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Placeholder table for view `zzzNodeWorksetV` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `zzzNodeWorksetV` (`connId` INT, `nodeId` INT, `isMain` INT, `isExact` INT, `added` INT); -- ----------------------------------------------------- -- View `zzzNodeWorksetV` -- ----------------------------------------------------- DROP VIEW IF EXISTS `zzzNodeWorksetV` ; DROP TABLE IF EXISTS `zzzNodeWorksetV`; CREATE OR REPLACE VIEW zzzNodeWorksetV AS select connId, nodeId, isMain, isExact, added from zzzNodeWorksetT where connId = connection_id(); SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;