-- MySQL Script generated by MySQL Workbench
-- 07/20/15 03:24:29
-- Model: New Model    Version: 1.0
-- MySQL Workbench Forward Engineering

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 `cacheNodeRecommendSumT`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `cacheNodeRecommendSumT` ;

CREATE TABLE IF NOT EXISTS `cacheNodeRecommendSumT` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `srcNodeId` INT UNSIGNED NOT NULL,
  `dstNodeId` INT UNSIGNED NOT NULL,
  `nodeTypeIdDistinctCount` INT UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `src_dst_uq` (`srcNodeId` ASC, `dstNodeId` ASC),
  INDEX `fk_cacheNodeRecommendSumT_nodeT2_idx` (`dstNodeId` ASC),
  CONSTRAINT `fk_cacheNodeRecommendSumT_nodeT1`
    FOREIGN KEY (`srcNodeId`)
    REFERENCES `nodeT` (`id`)
    ON DELETE CASCADE
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_cacheNodeRecommendSumT_nodeT2`
    FOREIGN KEY (`dstNodeId`)
    REFERENCES `nodeT` (`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;
