create database if not exists uav_user DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
use uav_user;
ALTER TABLE `uav_user`.`flyer_info` ADD COLUMN `enforcement_certificate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '执法证号' AFTER `id_card_date`;

ALTER TABLE `uav_user`.`flyer_info` ADD COLUMN `zfz_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '执法证照照片' AFTER `sfz2_img`;

ALTER TABLE `uav_user`.`sys_org` ADD COLUMN `valid_start_date` date NULL DEFAULT '2019-01-01' COMMENT '有效开始日期' AFTER `is_del`;

ALTER TABLE `uav_user`.`sys_org` ADD COLUMN `valid_end_date` date NULL DEFAULT '9999-12-31' COMMENT '有效结束日期' AFTER `valid_start_date`;

ALTER TABLE `uav_user`.`sys_org` ADD COLUMN `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '关联项目名' AFTER `valid_end_date`;

ALTER TABLE `uav_user`.`sys_org` ADD COLUMN `project_associates` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '项目申请人' AFTER `project_name`;

ALTER TABLE `uav_user`.`sys_org` ADD INDEX `idx_org_valid_time`(`is_frozen`, `valid_end_date`, `is_del`) USING BTREE;

CREATE TABLE `uav_user`.`sys_quota_template`  (
  `id` bigint NOT NULL COMMENT '主键',
  `quota_template_code` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '配额模板编码',
  `quota_template_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '配额模板名称',
  `quota_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '模板配置',
  `is_del` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
  `create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '创建用户id',
  `update_at` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新用户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '公司配额模板表' ROW_FORMAT = Dynamic;


ALTER TABLE `uav_user`.`sys_user` 
ADD COLUMN `account_md5` varchar(255) NULL COMMENT '用户账号MD5' AFTER `account`,
ADD COLUMN `telephone_md5` varchar(255) NULL COMMENT '用户手机号MD5' AFTER `telephone`,
ADD COLUMN `email_md5` varchar(255) NULL COMMENT '用户邮箱MD5' AFTER `email`;

