-- MySQL Script generated by MySQL Workbench
-- Sun Apr 28 10:32:05 2019
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

-- -----------------------------------------------------
-- Schema aroad
-- -----------------------------------------------------

-- -----------------------------------------------------
-- Schema aroad
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `aroad` DEFAULT CHARACTER SET utf8 ;
USE `aroad` ;

-- -----------------------------------------------------
-- Table `aroad`.`info_templates`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`info_templates` ;

CREATE TABLE IF NOT EXISTS `aroad`.`info_templates` (
  `template_id` INT NOT NULL AUTO_INCREMENT COMMENT '模板id',
  `template_name` VARCHAR(50) NOT NULL COMMENT '模板名称',
  `template_type` VARCHAR(20) NOT NULL COMMENT '模板类型',
  `template_use` VARCHAR(100) NOT NULL COMMENT '模板用途',
  `create_dept` VARCHAR(15) NOT NULL COMMENT '创建单位',
  `create_dept_id` INT NOT NULL COMMENT '创建单位id',
  `creater_id` INT NOT NULL COMMENT '创建人id',
  `create_time` DATETIME NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`template_id`))
ENGINE = InnoDB
COMMENT = '信息模板表';


-- -----------------------------------------------------
-- Table `aroad`.`info_informations`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`info_informations` ;

CREATE TABLE IF NOT EXISTS `aroad`.`info_informations` (
  `info_id` INT NOT NULL AUTO_INCREMENT COMMENT '信息id',
  `template_id` INT NOT NULL COMMENT '模板id',
  `info_title` VARCHAR(100) NOT NULL COMMENT '信息标题',
  `info_content` TEXT NOT NULL COMMENT '信息内容',
  `info_remark` VARCHAR(100) NULL COMMENT '信息备注',
  `reporter_id` INT NOT NULL COMMENT '发布人id',
  `reporting_time` DATETIME NOT NULL COMMENT '上报时间',
  PRIMARY KEY (`info_id`))
ENGINE = InnoDB
COMMENT = '信息表';


-- -----------------------------------------------------
-- Table `aroad`.`info_receivers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`info_receivers` ;

CREATE TABLE IF NOT EXISTS `aroad`.`info_receivers` (
  `id` INT NOT NULL AUTO_INCREMENT COMMENT '主键',
  `info_id` INT NOT NULL COMMENT '信息id',
  `receiver_id` INT NOT NULL COMMENT '接收人id',
  PRIMARY KEY (`id`))
ENGINE = InnoDB
COMMENT = '信息接收人表';


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
