/*
 Navicat Premium Data Transfer

 Source Server         : linux_testmysql
 Source Server Type    : MySQL
 Source Server Version : 50726
 Source Host           : 192.168.2.244:3306
 Source Schema         : cneeds_server

 Target Server Type    : MySQL
 Target Server Version : 50726
 File Encoding         : 65001

 Date: 18/03/2020 15:13:38
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for device_info
-- 设备信息表
-- ----------------------------
DROP TABLE IF EXISTS `device_info`;
CREATE TABLE `device_info`  (
  `device_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '设备id',
  `dept_id` bigint(20) DEFAULT NULL,
  `imei` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'imei',
  `iccid` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'iccid',
  `status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '状态0未激活，1已激活',
  `device_version` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '设备版本',
  `product_set` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品系列',
  `create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
  `active_time` datetime(0) DEFAULT NULL COMMENT '激活时间',
  `channel_nums` varchar(10000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '渠道号',
  `channel_nums_message` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '渠道号提示信息',
  `channel_rules` int(255) DEFAULT NULL COMMENT '0:白名单，1:黑名单',
  PRIMARY KEY (`device_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_log
-- 设备日志表
-- ----------------------------
DROP TABLE IF EXISTS `device_log`;
CREATE TABLE `device_log`  (
  `log_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `log_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'bug名字',
  `create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
  `device_id` bigint(20) DEFAULT NULL COMMENT '设备id',
  `status` int(11) DEFAULT NULL COMMENT '情况-1不可用 0未处理,1已查看',
  `create_username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '创建人名字',
  `user_id` bigint(20) DEFAULT NULL,
  `repetition_steps` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '复现步骤',
  `logfile_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '日志文件存放路径',
  `logfile_size` bigint(20) DEFAULT NULL COMMENT '日志文件大小',
  `logfile_status` int(11) DEFAULT NULL COMMENT '日志文件上传状态,-1,失败,0上传中,1完成',
  `log_accept_id` varchar (255) DEFAULT NULL COMMENT '移动端日志标识符',
  PRIMARY KEY (`log_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '测试上传的日志表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_logmedia
-- 设备日志音频文件表
-- ----------------------------
DROP TABLE IF EXISTS `device_logmedia`;
CREATE TABLE `device_logmedia`  (
  `logmedia_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `location_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '音频路径',
  `log_id` bigint(20) DEFAULT NULL,
  `type` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '格式',
  `file_size` bigint(20) DEFAULT NULL COMMENT '文件大小',
  PRIMARY KEY (`logmedia_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '日志音频表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for device_logsetting
-- 暂时用不上，设备日志设置信息表
-- ----------------------------
DROP TABLE IF EXISTS `device_logsetting`;
CREATE TABLE `device_logsetting`  (
  `logsetting_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `log_size` bigint(20) DEFAULT NULL COMMENT '日志容量（MB）',
  `device_id` bigint(20) DEFAULT NULL COMMENT '设备Id',
  PRIMARY KEY (`logsetting_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备日志设置' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for product_series
-- 设备产品系列表
-- ----------------------------
DROP TABLE IF EXISTS `product_series`;
CREATE TABLE `product_series`  (
  `series_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '系列id',
  `series_num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品系列号',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品系列详情',
  `create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`series_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for sys_dept
-- 系统-部门（客户）表
-- ----------------------------
DROP TABLE IF EXISTS `sys_dept`;
CREATE TABLE `sys_dept`  (
  `dept_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `parent_id` bigint(20) DEFAULT NULL COMMENT '上级部门ID，一级部门为0',
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '部门名称',
  `del_flag` int(11) DEFAULT NULL COMMENT '是否删除  -1：已删除  0：正常',
  `distributor_num` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '渠道商号',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '描述',
  PRIMARY KEY (`dept_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_dept
-- ----------------------------
INSERT INTO `sys_dept` VALUES (0, NULL, '根', 0, NULL, NULL);
INSERT INTO `sys_dept` VALUES (1, 0, '美行集团', 0, NULL, NULL);
INSERT INTO `sys_dept` VALUES (2, 1, '长沙分公司', 0, NULL, NULL);
INSERT INTO `sys_dept` VALUES (3, 1, '上海分公司', 0, NULL, NULL);
INSERT INTO `sys_dept` VALUES (4, 3, '技术部', 0, NULL, NULL);
INSERT INTO `sys_dept` VALUES (5, 3, '销售部', 0, NULL, NULL);

-- ----------------------------
-- Table structure for sys_func
-- 系统 - 功能表
-- ----------------------------
DROP TABLE IF EXISTS `sys_func`;
CREATE TABLE `sys_func`  (
  `func_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `parent_id` bigint(20) NOT NULL,
  `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `perms` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `type` int(11) DEFAULT NULL,
  `order_num` int(11) DEFAULT NULL,
  PRIMARY KEY (`func_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '功能表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_func
-- ----------------------------
INSERT INTO `sys_func` VALUES (1, 0, '系统管理', NULL, NULL, 0, 0);
INSERT INTO `sys_func` VALUES (2, 1, '用户管理', 'modules/sys/user.html', NULL, 1, 1);
INSERT INTO `sys_func` VALUES (3, 1, '角色管理', 'modules/sys/role.html', NULL, 1, 2);
INSERT INTO `sys_func` VALUES (4, 1, '菜单管理', 'modules/sys/menu.html', NULL, 1, 3);
INSERT INTO `sys_func` VALUES (15, 2, '查看', NULL, 'sys:user:list,sys:user:info', 2, 0);
INSERT INTO `sys_func` VALUES (16, 2, '新增', NULL, 'sys:user:save,sys:role:select', 2, 0);
INSERT INTO `sys_func` VALUES (17, 2, '修改', NULL, 'sys:user:update,sys:role:select', 2, 0);
INSERT INTO `sys_func` VALUES (18, 2, '删除', NULL, 'sys:user:delete', 2, 0);
INSERT INTO `sys_func` VALUES (19, 3, '查看', NULL, 'sys:role:list,sys:role:info', 2, 0);
INSERT INTO `sys_func` VALUES (20, 3, '新增', NULL, 'sys:role:save,sys:menu:perms', 2, 0);
INSERT INTO `sys_func` VALUES (21, 3, '修改', NULL, 'sys:role:update,sys:menu:perms', 2, 0);
INSERT INTO `sys_func` VALUES (22, 3, '删除', NULL, 'sys:role:delete', 2, 0);
INSERT INTO `sys_func` VALUES (23, 4, '查看', NULL, 'sys:menu:list,sys:menu:info', 2, 0);
INSERT INTO `sys_func` VALUES (24, 4, '新增', NULL, 'sys:menu:save,sys:menu:select', 2, 0);
INSERT INTO `sys_func` VALUES (25, 4, '修改', NULL, 'sys:menu:update,sys:menu:select', 2, 0);
INSERT INTO `sys_func` VALUES (26, 4, '删除', NULL, 'sys:menu:delete', 2, 0);
INSERT INTO `sys_func` VALUES (31, 1, '部门管理', 'modules/sys/dept.html', NULL, 1, 1);
INSERT INTO `sys_func` VALUES (32, 31, '查看', NULL, 'sys:dept:list,sys:dept:info', 2, 0);
INSERT INTO `sys_func` VALUES (33, 31, '新增', NULL, 'sys:dept:save,sys:dept:select', 2, 0);
INSERT INTO `sys_func` VALUES (34, 31, '修改', NULL, 'sys:dept:update,sys:dept:select', 2, 0);
INSERT INTO `sys_func` VALUES (35, 31, '删除', NULL, 'sys:dept:delete', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (36, 1, '产品系列管理', NULL, 'configManagement:productSeries:list', 1, 1);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (37, 36, '添加产品系列', NULL, 'configManagement:productSeries:add', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (38, 36, '修改产品系列', NULL, 'configManagement:productSeries:edit', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (39, 1, '渠道号管理', NULL, 'configManagement:deviceChannel:list', 1, 2);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (40, 39, '添加渠道号', NULL, 'configManagement:deviceChannel:add', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (41, 39, '修改渠道号', NULL, 'configManagement:deviceChannel:edit', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (42, 1, '设备控制,设备渠道号统计', NULL, 'deviceManagement:device:list', 1, 1);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (43, 42, '导入设备', NULL, 'deviceManagement:device:add', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (44, 42, '变更产品系列,适配配置,批量配置', NULL, 'deviceManagement:device:edit', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (46, 1, '日志列表', NULL, 'remotelog:logfile:list', 1, 1);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (47, 36, '删除产品系列', NULL, 'configManagement:productSeries:delete', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (48, 42, '删除设备', NULL, 'deviceManagement:device:delete', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (49, 39, '删除渠道号', NULL, 'configManagement:deviceChannel:delete', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (50, 46, '修改日志', NULL, 'remotelog:logfile:edit', 2, 0);
INSERT INTO `cneeds_server`.`sys_func`(`func_id`, `parent_id`, `name`, `url`, `perms`, `type`, `order_num`) VALUES (51, 46, '删除日志', NULL, 'remotelog:logfile:delete', 2, 0);

-- ----------------------------
-- Table structure for sys_role
-- 系统 - 角色表
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role`  (
  `role_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `role_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '角色名称',
  `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
  `dept_id` bigint(20) DEFAULT NULL COMMENT '部门Id',
  `create_time` datetime(0) DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`role_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO `sys_role` VALUES (1, '管理员', '描述', 1, '2020-03-10 12:06:37');
INSERT INTO `sys_role` VALUES (26, 'zzzzzzzzzz', 'zzzzzzzzzzzzzzz', 0, '2020-03-13 04:51:20');

-- ----------------------------
-- Table structure for sys_role_dept
-- 系统 - 角色部门关系表
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_dept`;
CREATE TABLE `sys_role_dept`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `role_id` bigint(20) DEFAULT NULL COMMENT '角色id',
  `dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 466 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门与角色映射表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_role_dept
-- ----------------------------
INSERT INTO `sys_role_dept` VALUES (463, 26, 3);
INSERT INTO `sys_role_dept` VALUES (464, 26, 4);
INSERT INTO `sys_role_dept` VALUES (465, 26, 5);

-- ----------------------------
-- Table structure for sys_role_func
-- 系统 - 角色功能表 
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_func`;
CREATE TABLE `sys_role_func`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `role_id` bigint(20) DEFAULT NULL COMMENT '角色Id',
  `func_id` bigint(20) DEFAULT NULL COMMENT '功能Id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 489 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '功能与角色映射表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_role_func
-- ----------------------------
INSERT INTO `sys_role_func` VALUES (484, 26, 2);
INSERT INTO `sys_role_func` VALUES (485, 26, 15);
INSERT INTO `sys_role_func` VALUES (486, 26, 16);
INSERT INTO `sys_role_func` VALUES (487, 26, 17);
INSERT INTO `sys_role_func` VALUES (488, 26, 18);

-- ----------------------------
-- Table structure for sys_user
-- 系统 - 用户（账户）表
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`  (
  `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `username` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
  `password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
  `email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '邮箱',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '简介',
  `mobile` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '手机',
  `status` int(11) DEFAULT NULL COMMENT '账户状态  0：禁用   1：正常',
  `create_time` date DEFAULT NULL COMMENT '创建时间',
  `dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
  PRIMARY KEY (`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT INTO `sys_user` VALUES (0, 'admin', '$2a$10$/uKcZ27sVZSWRRzSx9PEQ.ggLriOfc6AqILEyOYauVQQt5akh4YEm', 'YzcmCZNvbXocrsz9dm8e', 'root@cneeds.com.cn', '13612345678', 1, '2016-11-11', 0);

-- ----------------------------
-- Table structure for sys_user_role
-- 系统 - 用户角色关系表
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  `role_id` bigint(20) DEFAULT NULL COMMENT '角色id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色用户映射表' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;


-- ----------------------------
-- Table structure for sys_user_dept
-- 系统 - 用户部门关系表
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_dept`;
CREATE TABLE `sys_user_dept`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
  `dept_id` bigint(20) DEFAULT NULL COMMENT '部门id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 466 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '部门与角色映射表' ROW_FORMAT = Dynamic;


-- ----------------------------
-- Table structure for sys_user_func
-- 系统 - 用户功能关系表
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_func`;
CREATE TABLE `sys_user_func`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT NULL COMMENT '用户Id',
  `func_id` bigint(20) DEFAULT NULL COMMENT '功能Id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 489 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '功能与角色映射表' ROW_FORMAT = Dynamic;


-- 2020-05-06 加唯一索引
ALTER TABLE `cneeds_server`.`device_info`
ADD UNIQUE INDEX `IMEI_UNIQUE`(`imei`) USING BTREE COMMENT 'imei唯一';

ALTER TABLE `cneeds_server`.`product_series`
ADD UNIQUE INDEX `SERIES_NUM_UNIQUE`(`series_num`) USING BTREE COMMENT '系列号唯一';


-- 202-05-09
-- ----------------------------
-- Table structure for device_channel
-- 渠道号表
-- ----------------------------
CREATE TABLE `device_channel` (
  `channel_id` bigint(20) NOT NULL AUTO_INCREMENT,
  `channel_num` varchar(255) DEFAULT NULL COMMENT '渠道号',
  `brand` varchar(255) DEFAULT NULL COMMENT '品牌',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`channel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for device_info_channel
-- 设备信息 - 渠道号 映射表
-- ----------------------------
CREATE TABLE `device_info_channel` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `device_id` bigint(20) DEFAULT NULL,
  `channel_id` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- 2020-05-13
ALTER TABLE `cneeds_server`.`device_info`
DROP COLUMN `channel_nums`;

-- 2020-05-14
ALTER TABLE `cneeds_server`.`device_log`
ADD COLUMN `device_version` varchar(255) COMMENT '设备版本号' AFTER `log_accept_id`;


-- 2020-06-29

ALTER TABLE `cneeds_server`.`device_info`
ADD COLUMN `sn` varchar(255) COMMENT 'sn号' AFTER `channel_rules`,
ADD COLUMN `ca_certificate_status` varchar(255) COMMENT 'ca证书状态 -1 未下载，0 已下载 类型：非量产 1 已下载 类型：量产，2 已下载 类型：非量产，未验证 3 已下载 类型：量产，未验证' AFTER `sn`;

ALTER TABLE `cneeds_server`.`device_info`
CHANGE COLUMN `status` `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci
DEFAULT NULL COMMENT '状态0未激活，1已激活' AFTER `iccid`;

-- 2020-07-14

ALTER TABLE `cneeds_server`.`device_info`
MODIFY COLUMN `active_status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 0 COMMENT '状态0未激活，1已激活' AFTER `iccid`,
MODIFY COLUMN `channel_rules` int(255) DEFAULT 1 COMMENT '0:白名单，1:黑名单' AFTER `channel_nums_message`,
MODIFY COLUMN `ca_certificate_status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT -1 COMMENT 'ca证书状态 -1 未下载，0 已下载 类型：非量产 1 已下载 类型：量产，2 已下载 类型：非量产，未验证 3 已下载 类型：量产，未验证' AFTER `sn`;

