-- MySQL Script generated by MySQL Workbench
-- Wed May  8 14:34:45 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`.`emergency_event`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `aroad`.`emergency_event` ;

CREATE TABLE IF NOT EXISTS `aroad`.`emergency_event` (
  `event_id` INT NOT NULL AUTO_INCREMENT COMMENT '事件id',
  `event_name` VARCHAR(45) NOT NULL COMMENT '事件名称',
  `event_type` VARCHAR(10) NOT NULL COMMENT '事件类型',
  `event_detail` VARCHAR(225) NOT NULL COMMENT '事件详情',
  `influence` VARCHAR(10) NOT NULL COMMENT '受影响程度',
  `road` VARCHAR(45) NOT NULL COMMENT '道路',
  `station_number` VARCHAR(20) NOT NULL COMMENT '桩号',
  `reporting_dept` VARCHAR(45) NOT NULL COMMENT '上报单位',
  `reporting_dept_id` INT NOT NULL COMMENT '上报单位id',
  `reporter_id` INT NOT NULL COMMENT '上报人id',
  `reporting_time` DATETIME NOT NULL COMMENT '上报时间',
  `status` VARCHAR(10) NOT NULL DEFAULT '未处理' COMMENT '状态',
  PRIMARY KEY (`event_id`))
ENGINE = InnoDB
COMMENT = '应急事件表';


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

CREATE TABLE IF NOT EXISTS `aroad`.`event_deal` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `event_id` VARCHAR(45) NOT NULL COMMENT '事件id',
  `deal_content` VARCHAR(225) NOT NULL COMMENT '处置内容',
  `deal_type` BIT NOT NULL COMMENT '处置类型： 0：下达指令 1：处置反馈',
  `deal_time` DATETIME NOT NULL COMMENT '处置时间',
  `user_id` INT NOT NULL COMMENT '处置人id',
  `user` VARCHAR(10) NOT NULL COMMENT '处置人',
  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;
