/*
 Navicat Premium Data Transfer

 Source Server         : localhost-mysql
 Source Server Type    : MySQL
 Source Server Version : 50732
 Source Host           : 127.0.0.1:3306
 Source Schema         : reghao_devops_rdb

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

 Date: 11/11/2021 14:57:32
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for app_building
-- ----------------------------
DROP TABLE IF EXISTS `app_building`;
CREATE TABLE `app_building` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `build_by` varchar(255) DEFAULT NULL,
  `build_log_id` varchar(255) DEFAULT NULL,
  `build_result` varchar(255) NOT NULL,
  `build_time` datetime(6) DEFAULT NULL,
  `commit_id` varchar(255) DEFAULT NULL,
  `commit_time` datetime(6) DEFAULT NULL,
  `package_path` varchar(255) DEFAULT NULL,
  `app_config_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_6yldh4xvx55sfwx0vih4p74l4` (`app_config_id`),
  CONSTRAINT `FK9lsa0hnvjbqfxp33wkvwrq0ln` FOREIGN KEY (`app_config_id`) REFERENCES `app_config` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for app_config
-- ----------------------------
DROP TABLE IF EXISTS `app_config`;
CREATE TABLE `app_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `app_id` varchar(64) NOT NULL,
  `app_name` varchar(255) NOT NULL,
  `app_repo` varchar(255) NOT NULL,
  `app_root_path` varchar(255) NOT NULL,
  `app_type` varchar(255) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `dockerfile` text,
  `env` varchar(255) NOT NULL,
  `exec_bin_name` varchar(255) DEFAULT NULL,
  `health_check` varchar(255) DEFAULT NULL,
  `http_port` int(11) DEFAULT NULL,
  `proj_dirname` varchar(255) NOT NULL,
  `repo_branch` varchar(255) NOT NULL,
  `compiler_config_id` int(11) NOT NULL,
  `packer_config_id` int(11) NOT NULL,
  `repo_auth_config_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_boipwfawtfve9o09lnb5le29a` (`app_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for app_deploy_config
-- ----------------------------
DROP TABLE IF EXISTS `app_deploy_config`;
CREATE TABLE `app_deploy_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `pack_type` varchar(255) NOT NULL,
  `start_home` varchar(255) DEFAULT NULL,
  `start_script` text NOT NULL,
  `unpack_script` text,
  `app_config_id` int(11) NOT NULL,
  `machine_host_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FKhqgrewybinoowtbsbf63kf4pl` (`app_config_id`),
  KEY `FK7ionisohyo4pv58vwkkdugt35` (`machine_host_id`),
  CONSTRAINT `FK7ionisohyo4pv58vwkkdugt35` FOREIGN KEY (`machine_host_id`) REFERENCES `machine_host` (`id`),
  CONSTRAINT `FKhqgrewybinoowtbsbf63kf4pl` FOREIGN KEY (`app_config_id`) REFERENCES `app_config` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for app_deploying
-- ----------------------------
DROP TABLE IF EXISTS `app_deploying`;
CREATE TABLE `app_deploying` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `build_log_id` varchar(255) DEFAULT NULL,
  `commit_id` varchar(255) DEFAULT NULL,
  `deploy_by` varchar(255) DEFAULT NULL,
  `deploy_result` varchar(255) NOT NULL,
  `deploy_time` datetime(6) DEFAULT NULL,
  `package_path` varchar(255) DEFAULT NULL,
  `app_deploy_config_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_qahn6tavk8skmp27vhi1pna17` (`app_deploy_config_id`),
  CONSTRAINT `FK2tkqafeq2bi3gi4ec4s113hj2` FOREIGN KEY (`app_deploy_config_id`) REFERENCES `app_deploy_config` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for app_monitor
-- ----------------------------
DROP TABLE IF EXISTS `app_monitor`;
CREATE TABLE `app_monitor` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `app_build_id` int(11) DEFAULT NULL,
  `app_config_id` int(11) NOT NULL,
  `app_deploy_id` int(11) DEFAULT NULL,
  `app_health_check_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_p8g8asx4dnnqt1dlvlgf8c9rw` (`app_config_id`),
  KEY `FKmq2iryo1aai1eqmxy7q9ed77i` (`app_build_id`),
  KEY `FKf2ickc2ylt68wnl9sh3goaeva` (`app_deploy_id`),
  KEY `FKoicn3j9netc1st53wwb2j5mll` (`app_health_check_id`),
  CONSTRAINT `FKf2ickc2ylt68wnl9sh3goaeva` FOREIGN KEY (`app_deploy_id`) REFERENCES `notify_group` (`id`),
  CONSTRAINT `FKmq2iryo1aai1eqmxy7q9ed77i` FOREIGN KEY (`app_build_id`) REFERENCES `notify_group` (`id`),
  CONSTRAINT `FKoicn3j9netc1st53wwb2j5mll` FOREIGN KEY (`app_health_check_id`) REFERENCES `notify_group` (`id`),
  CONSTRAINT `FKqcktms0d2jc0m3iqjieuhqn4m` FOREIGN KEY (`app_config_id`) REFERENCES `app_config` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for app_running
-- ----------------------------
DROP TABLE IF EXISTS `app_running`;
CREATE TABLE `app_running` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `last_check` datetime(6) DEFAULT NULL,
  `pid` int(11) DEFAULT NULL,
  `start_time` datetime(6) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `app_deploying_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_tqy0dk2oyqysje9g7s0ngh36g` (`app_deploying_id`),
  CONSTRAINT `FK2j1kmif6x371wgt3gbw7y825q` FOREIGN KEY (`app_deploying_id`) REFERENCES `app_deploying` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for build_dir
-- ----------------------------
DROP TABLE IF EXISTS `build_dir`;
CREATE TABLE `build_dir` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `avail` varchar(255) NOT NULL,
  `dir_path` varchar(255) NOT NULL,
  `machine_id` varchar(255) NOT NULL,
  `machine_ipv4` varchar(255) NOT NULL,
  `mounted_on` varchar(255) NOT NULL,
  `total` varchar(255) NOT NULL,
  `used` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_hk1kw8yctt67349i4kaougm5e` (`machine_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for compiler_config
-- ----------------------------
DROP TABLE IF EXISTS `compiler_config`;
CREATE TABLE `compiler_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `compile_cmd` varchar(255) DEFAULT NULL,
  `home_path` varchar(255) DEFAULT NULL,
  `machine_id` varchar(255) NOT NULL,
  `machine_ipv4` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_8qb44ffa5pma9xekiphefr9sp` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for ding_account
-- ----------------------------
DROP TABLE IF EXISTS `ding_account`;
CREATE TABLE `ding_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `notify_account_id` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for machine_host
-- ----------------------------
DROP TABLE IF EXISTS `machine_host`;
CREATE TABLE `machine_host` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `boot_time` bigint(20) NOT NULL,
  `env` varchar(255) NOT NULL,
  `last_check` bigint(20) NOT NULL,
  `machine_id` varchar(255) NOT NULL,
  `machine_ipv4` varchar(255) NOT NULL,
  `os_arch` varchar(255) NOT NULL,
  `os_name` varchar(255) NOT NULL,
  `os_version` varchar(255) NOT NULL,
  `ipv4` varchar(255) DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `port` int(11) DEFAULT NULL,
  `rsa_prikey` text,
  `username` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_lo1x88vamyh2o34gdap4aw7jr` (`machine_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for machine_info
-- ----------------------------
DROP TABLE IF EXISTS `machine_info`;
CREATE TABLE `machine_info` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `arch` varchar(255) NOT NULL,
  `boot_time` bigint(20) NOT NULL,
  `byte_order` varchar(255) NOT NULL,
  `logical_core` int(11) NOT NULL,
  `machine_id` varchar(255) NOT NULL,
  `machine_ipv4` varchar(255) NOT NULL,
  `mem_total` bigint(20) NOT NULL,
  `model_name` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `physical_core` int(11) NOT NULL,
  `swap_total` bigint(20) DEFAULT NULL,
  `vendor` varchar(255) NOT NULL,
  `version` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_qtvbx85mqly0sgycqp1xt208s` (`machine_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for machine_info_disk_infos
-- ----------------------------
DROP TABLE IF EXISTS `machine_info_disk_infos`;
CREATE TABLE `machine_info_disk_infos` (
  `machine_info_id` int(11) NOT NULL,
  `disk_path` varchar(255) DEFAULT NULL,
  `fs_type` varchar(255) DEFAULT NULL,
  `inode_total` bigint(20) DEFAULT NULL,
  `mounted_on` varchar(255) DEFAULT NULL,
  `total` bigint(20) DEFAULT NULL,
  KEY `FKjn32n1mvn6uuiqn0n6uwrqe2i` (`machine_info_id`),
  CONSTRAINT `FKjn32n1mvn6uuiqn0n6uwrqe2i` FOREIGN KEY (`machine_info_id`) REFERENCES `machine_info` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for machine_info_network_infos
-- ----------------------------
DROP TABLE IF EXISTS `machine_info_network_infos`;
CREATE TABLE `machine_info_network_infos` (
  `machine_info_id` int(11) NOT NULL,
  `iface` varchar(255) DEFAULT NULL,
  `ipv4` varchar(255) DEFAULT NULL,
  `ipv6` varchar(255) DEFAULT NULL,
  `mac` varchar(255) DEFAULT NULL,
  `public_ipv4` varchar(255) DEFAULT NULL,
  KEY `FKfs6r0haxt8dx5ak8wp91pwojn` (`machine_info_id`),
  CONSTRAINT `FKfs6r0haxt8dx5ak8wp91pwojn` FOREIGN KEY (`machine_info_id`) REFERENCES `machine_info` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for menu
-- ----------------------------
DROP TABLE IF EXISTS `menu`;
CREATE TABLE `menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `icon` varchar(255) NOT NULL,
  `is_enabled` bit(1) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `pid` int(11) NOT NULL,
  `pos` int(11) NOT NULL,
  `type` varchar(255) DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for notify_group
-- ----------------------------
DROP TABLE IF EXISTS `notify_group`;
CREATE TABLE `notify_group` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `notify_account_id` varchar(255) NOT NULL,
  `notify_name` varchar(255) DEFAULT NULL,
  `notify_type` varchar(255) DEFAULT NULL,
  `receiver` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_gvaf84xd3bnxxf60r4whgv4e9` (`notify_account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for packer_config
-- ----------------------------
DROP TABLE IF EXISTS `packer_config`;
CREATE TABLE `packer_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `binfiles_dirname` varchar(255) NOT NULL,
  `machine_id` varchar(255) NOT NULL,
  `machine_ipv4` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `target_path` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_ilu7yfvuir3cvd8oqiemwrqh8` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for repo_auth_config
-- ----------------------------
DROP TABLE IF EXISTS `repo_auth_config`;
CREATE TABLE `repo_auth_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `auth_type` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `password` varchar(255) DEFAULT NULL,
  `rsa_prikey` text,
  `type` varchar(255) NOT NULL,
  `username` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_cfu57vn4gixedymokbkcnjpd0` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_fmnrnqscmgmb1ht3kirjbjwl` (`title`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for role_menu
-- ----------------------------
DROP TABLE IF EXISTS `role_menu`;
CREATE TABLE `role_menu` (
  `role_id` int(11) NOT NULL,
  `menu_id` int(11) NOT NULL,
  PRIMARY KEY (`role_id`,`menu_id`),
  KEY `FKfg4e2mb2318tph615gh44ll3` (`menu_id`),
  CONSTRAINT `FKfg4e2mb2318tph615gh44ll3` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`id`),
  CONSTRAINT `FKqyvxw2gg2qk0wld3bqfcb58vq` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for sys_env
-- ----------------------------
DROP TABLE IF EXISTS `sys_env`;
CREATE TABLE `sys_env` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `env` varchar(255) NOT NULL,
  `env_name` varchar(255) DEFAULT NULL,
  `is_default` bit(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_6vnobashedni21enf9pw1ohw` (`env`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `create_time` datetime(6) NOT NULL,
  `is_delete` bit(1) NOT NULL,
  `update_time` datetime(6) NOT NULL,
  `avatar_url` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `gender` int(11) DEFAULT NULL,
  `is_enabled` bit(1) DEFAULT NULL,
  `is_locked` bit(1) DEFAULT NULL,
  `mobile_phone` varchar(255) DEFAULT NULL,
  `nickname` varchar(255) DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `salt` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_sb8bbouer5wak8vyiiy4pf2bx` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS `user_role`;
CREATE TABLE `user_role` (
  `user_id` int(11) NOT NULL,
  `role` varchar(255) DEFAULT NULL,
  KEY `FK859n2jvi8ivhui0rl0esws6o` (`user_id`),
  CONSTRAINT `FK859n2jvi8ivhui0rl0esws6o` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

SET FOREIGN_KEY_CHECKS = 1;
