/*
SQLyog Community v13.1.9 (64 bit)
MySQL - 5.7.19 : Database - forward
*********************************************************************
*/



CREATE DATABASE /*!32312 IF NOT EXISTS*/`forward` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `forward`;

/*Table structure for table `zw_forward_destination` */


CREATE TABLE `zw_forward_destination` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL COMMENT '转发目的地名称',
  `address` varchar(50) DEFAULT NULL COMMENT '服务器地址(ip/域名)',
  `port` int(6) DEFAULT NULL COMMENT '端口号',
  `status` tinyint(4) DEFAULT NULL COMMENT '转发状态 0:关闭转发 1:打开转发',
  `flag` tinyint(4) DEFAULT '1' COMMENT '0: 删除;1:未删除',
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `INDEX_IP` (`address`,`port`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `zw_forward_destination` */

/*Table structure for table `zw_forward_device` */


CREATE TABLE `zw_forward_device` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `mobile` varchar(20) NOT NULL COMMENT '终端手机号',
  `flag` tinyint(4) DEFAULT '1' COMMENT '0: 删除;1:未删除',
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `MOBILE_INDEX` (`mobile`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `zw_forward_device` */

/*Table structure for table `zw_forward_link` */


CREATE TABLE `zw_forward_link` (
  `device_id` bigint(20) NOT NULL COMMENT '终端id',
  `dest_id` bigint(20) NOT NULL COMMENT '转发目的地id',
  `type` tinyint(4) NOT NULL COMMENT '转发模式 0:双向 1:单向',
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`device_id`,`dest_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/*Data for the table `zw_forward_link` */

/*Table structure for table `zw_forward_personalized` */


CREATE TABLE `zw_forward_personalized` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `login_title` varchar(100) DEFAULT NULL COMMENT '首页标题',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

/*Data for the table `zw_forward_personalized` */

insert  into `zw_forward_personalized`(`id`,`login_title`) values 
(1,'车联网转发工具');


