Skip to content

Commit

Permalink
add template conf and cross cluster ddl
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Oct 25, 2023
1 parent 9c73141 commit 3983c0e
Show file tree
Hide file tree
Showing 10 changed files with 1,052 additions and 39 deletions.
77 changes: 73 additions & 4 deletions linkis-dist/package/db/linkis_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ CREATE TABLE `linkis_ps_configuration_config_key`(
`default_value` varchar(200) DEFAULT NULL COMMENT 'Adopted when user does not set key',
`validate_type` varchar(50) DEFAULT NULL COMMENT 'Validate type, one of the following: None, NumInterval, FloatInterval, Include, Regex, OPF, Custom Rules',
`validate_range` varchar(50) DEFAULT NULL COMMENT 'Validate range',
`engine_conn_type` varchar(50) DEFAULT NULL COMMENT 'engine type,such as spark,hive etc',
`engine_conn_type` varchar(50) DEFAULT '' COMMENT 'engine type,such as spark,hive etc',
`is_hidden` tinyint(1) DEFAULT NULL COMMENT 'Whether it is hidden from user. If set to 1(true), then user cannot modify, however, it could still be used in back-end',
`is_advanced` tinyint(1) DEFAULT NULL COMMENT 'Whether it is an advanced parameter. If set to 1(true), parameters would be displayed only when user choose to do so',
`level` tinyint(1) DEFAULT NULL COMMENT 'Basis for displaying sorting in the front-end. Higher the level is, higher the rank the parameter gets',
`treeName` varchar(20) DEFAULT NULL COMMENT 'Reserved field, representing the subdirectory of engineType',
`en_description` varchar(200) DEFAULT NULL COMMENT 'english description',
`en_name` varchar(100) DEFAULT NULL COMMENT 'english name',
`en_treeName` varchar(100) DEFAULT NULL COMMENT 'english treeName',
UNIQUE INDEX `uniq_key_ectype` (`key`,`engine_conn_type`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Expand Down Expand Up @@ -84,6 +85,61 @@ CREATE TABLE `linkis_ps_configuration_category` (
UNIQUE INDEX `uniq_label_id` (`label_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

DROP TABLE IF EXISTS `linkis_ps_configuration_template_config_key`;
CREATE TABLE IF NOT EXISTS `linkis_ps_configuration_template_config_key` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`template_name` VARCHAR(200) NOT NULL COMMENT 'Configuration template name redundant storage',
`template_uuid` VARCHAR(36) NOT NULL COMMENT 'uuid template id recorded by the third party',
`key_id` BIGINT(20) NOT NULL COMMENT 'id of linkis_ps_configuration_config_key',
`config_value` VARCHAR(200) NULL DEFAULT NULL COMMENT 'configuration value',
`max_value` VARCHAR(50) NULL DEFAULT NULL COMMENT 'upper limit value',
`min_value` VARCHAR(50) NULL DEFAULT NULL COMMENT 'Lower limit value (reserved)',
`validate_range` VARCHAR(50) NULL DEFAULT NULL COMMENT 'Verification regularity (reserved)',
`is_valid` VARCHAR(2) DEFAULT 'Y' COMMENT 'Is it valid? Reserved Y/N',
`create_by` VARCHAR(50) NOT NULL COMMENT 'Creator',
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_by` VARCHAR(50) NULL DEFAULT NULL COMMENT 'Update by',
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_tid_kid` (`template_uuid`, `key_id`),
UNIQUE INDEX `uniq_tname_kid` (`template_uuid`, `key_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

DROP TABLE IF EXISTS `linkis_ps_configuration_key_limit_for_user`;
CREATE TABLE IF NOT EXISTS `linkis_ps_configuration_key_limit_for_user` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
`user_name` VARCHAR(50) NOT NULL COMMENT 'username',
`combined_label_value` VARCHAR(128) NOT NULL COMMENT 'Combined label combined_userCreator_engineType such as hadoop-IDE,spark-2.4.3',
`key_id` BIGINT(20) NOT NULL COMMENT 'id of linkis_ps_configuration_config_key',
`config_value` VARCHAR(200) NULL DEFAULT NULL COMMENT 'configuration value',
`max_value` VARCHAR(50) NULL DEFAULT NULL COMMENT 'upper limit value',
`min_value` VARCHAR(50) NULL DEFAULT NULL COMMENT 'Lower limit value (reserved)',
`latest_update_template_uuid` VARCHAR(36) NOT NULL COMMENT 'uuid template id recorded by the third party',
`is_valid` VARCHAR(2) DEFAULT 'Y' COMMENT 'Is it valid? Reserved Y/N',
`create_by` VARCHAR(50) NOT NULL COMMENT 'Creator',
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_by` VARCHAR(50) NULL DEFAULT NULL COMMENT 'Update by',
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`),
UNIQUE INDEX `uniq_com_label_kid` (`combined_label_value`, `key_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

DROP TABLE IF EXISTS `linkis_ps_configutation_lm_across_cluster_rule`;
CREATE TABLE IF NOT EXISTS linkis_ps_configutation_lm_across_cluster_rule (
id INT AUTO_INCREMENT COMMENT 'Rule ID, auto-increment primary key',
cluster_name char(32) NOT NULL COMMENT 'Cluster name, cannot be empty',
creator char(32) NOT NULL COMMENT 'Creator, cannot be empty',
username char(32) NOT NULL COMMENT 'User, cannot be empty',
create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time, cannot be empty',
create_by char(32) NOT NULL COMMENT 'Creator, cannot be empty',
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Modification time, cannot be empty',
update_by char(32) NOT NULL COMMENT 'Updater, cannot be empty',
rules varchar(256) NOT NULL COMMENT 'Rule content, cannot be empty',
is_valid VARCHAR(2) DEFAULT 'N' COMMENT 'Is it valid Y/N',
PRIMARY KEY (id),
UNIQUE KEY idx_creator_username (creator, username)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

--
-- New linkis job
--
Expand Down Expand Up @@ -135,6 +191,7 @@ DROP TABLE IF EXISTS `linkis_ps_common_lock`;
CREATE TABLE `linkis_ps_common_lock` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lock_object` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`locker` varchar(255) COLLATE utf8_bin NOT NULL,
`time_out` longtext COLLATE utf8_bin,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -153,6 +210,8 @@ DROP TABLE IF EXISTS `linkis_ps_udf_manager`;
CREATE TABLE `linkis_ps_udf_manager` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_name` varchar(20) DEFAULT NULL,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Expand All @@ -166,6 +225,8 @@ CREATE TABLE `linkis_ps_udf_shared_group` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`udf_id` bigint(20) NOT NULL,
`shared_group` varchar(50) NOT NULL,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Expand All @@ -174,7 +235,9 @@ CREATE TABLE `linkis_ps_udf_shared_info`
(
`id` bigint(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
`udf_id` bigint(20) NOT NULL,
`user_name` varchar(50) NOT NULL
`user_name` varchar(50) NOT NULL,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
Expand All @@ -190,7 +253,8 @@ CREATE TABLE `linkis_ps_udf_tree` (
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`category` varchar(50) DEFAULT NULL COMMENT 'Used to distinguish between udf and function',
PRIMARY KEY (`id`)
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_parent_name_uname_category` (`parent`,`name`,`user_name`,`category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand All @@ -203,7 +267,10 @@ CREATE TABLE `linkis_ps_udf_user_load` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`udf_id` bigint(20) NOT NULL,
`user_name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
`update_time` datetime DEFAULT CURRENT_TIMESTAMP,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uniq_uid_uname` (`udf_id`, `user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `linkis_ps_udf_baseinfo`;
Expand Down Expand Up @@ -235,6 +302,7 @@ CREATE TABLE `linkis_ps_udf_version` (
`use_format` varchar(255) DEFAULT NULL,
`description` varchar(255) NOT NULL COMMENT 'version desc',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`md5` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Expand Down Expand Up @@ -486,6 +554,7 @@ CREATE TABLE if not exists `linkis_ps_bml_resources` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Updated time',
`updator` varchar(50) DEFAULT NULL COMMENT 'updator',
`enable_flag` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Status, 1: normal, 0: frozen',
unique key `uniq_rid_eflag`(`resource_id`, `enable_flag`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4;

Expand Down
65 changes: 61 additions & 4 deletions linkis-dist/package/db/linkis_ddl_pg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ COMMENT ON COLUMN "linkis_ps_configuration_config_key"."treeName" IS 'Reserved f
COMMENT ON COLUMN "linkis_ps_configuration_config_key"."treeName" IS 'english description';
COMMENT ON COLUMN "linkis_ps_configuration_config_key"."treeName" IS 'english name';
COMMENT ON COLUMN "linkis_ps_configuration_config_key"."treeName" IS 'english treeName';

CREATE UNIQUE INDEX uniq_key_ectype ON linkis_ps_configuration_config_key USING btree ("key","engine_conn_type");

DROP TABLE IF EXISTS "linkis_ps_configuration_key_engine_relation";
CREATE TABLE linkis_ps_configuration_key_engine_relation (
Expand Down Expand Up @@ -98,6 +98,53 @@ CREATE TABLE linkis_ps_configuration_category (
);
CREATE UNIQUE INDEX uniq_label_id_cc ON linkis_ps_configuration_category USING btree (label_id);

DROP TABLE IF EXISTS linkis_ps_configuration_template_config_key;
CREATE TABLE linkis_ps_configuration_template_config_key (
id BIGINT PRIMARY KEY NOT NULL,
template_name VARCHAR(200) NOT NULL,
template_uuid VARCHAR(36) NOT NULL,
key_id BIGINT NOT NULL,
config_value VARCHAR(200) NULL DEFAULT NULL,
max_value VARCHAR(50) NULL DEFAULT NULL,
min_value VARCHAR(50) NULL DEFAULT NULL,
validate_range VARCHAR(50) NULL DEFAULT NULL,
is_valid VARCHAR(2) DEFAULT 'Y',
create_by VARCHAR(50) NOT NULL,
create_time TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW(),
update_by VARCHAR(50) NULL DEFAULT NULL,
update_time TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW()
);

DROP TABLE IF EXISTS linkis_ps_configuration_key_limit_for_user;
CREATE TABLE IF NOT EXISTS linkis_ps_configuration_key_limit_for_user (
id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1),
user_name varchar(50) NOT NULL,
combined_label_value varchar(128) NOT NULL,
key_id bigint NOT NULL,
config_value varchar(200) NULL DEFAULT NULL,
max_value varchar(50) NULL DEFAULT NULL,
min_value varchar(50) NULL DEFAULT NULL,
latest_update_template_uuid varchar(36) NOT NULL,
is_valid varchar(2) DEFAULT 'Y',
create_by varchar(50) NOT NULL,
create_time timestamp without time zone DEFAULT now(),
update_by varchar(50) NULL DEFAULT NULL,
update_time timestamp without time zone DEFAULT now()
);

DROP TABLE IF EXISTS linkis_ps_configutation_lm_across_cluster_rule;
CREATE TABLE IF NOT EXISTS linkis_ps_configutation_lm_across_cluster_rule (
rule_id INT PRIMARY KEY AUTOINCREMENT,
cluster_name varchar(32) NOT NULL,
creator varchar(32) NOT NULL,
username varchar(32) NOT NULL,
create_time TIMESTAMP NOT NULL DEFAULT NOW(),
create_by varchar(32) NOT NULL,
update_time TIMESTAMP NOT NULL DEFAULT NOW(),
update_by varchar(32),
rules TEXT NOT NULL,
is_valid varchar(1) DEFAULT'N'
);

DROP TABLE IF EXISTS "linkis_ps_job_history_group_history";
CREATE TABLE linkis_ps_job_history_group_history (
Expand Down Expand Up @@ -176,6 +223,7 @@ DROP TABLE IF EXISTS "linkis_ps_common_lock";
CREATE TABLE linkis_ps_common_lock (
id bigserial NOT NULL,
lock_object varchar(255) NULL,
locker varchar(255) NOT NULL,
time_out text NULL,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -188,6 +236,8 @@ DROP TABLE IF EXISTS "linkis_ps_udf_manager";
CREATE TABLE linkis_ps_udf_manager (
id bigserial NOT NULL,
user_name varchar(20) NULL,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT linkis_udf_manager_pkey PRIMARY KEY (id)
);

Expand All @@ -197,6 +247,8 @@ CREATE TABLE linkis_ps_udf_shared_group (
id bigserial NOT NULL,
udf_id int8 NOT NULL,
shared_group varchar(50) NOT NULL,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT linkis_udf_shared_group_pkey PRIMARY KEY (id)
);

Expand All @@ -206,6 +258,8 @@ CREATE TABLE linkis_ps_udf_shared_info (
id bigserial NOT NULL,
udf_id int8 NOT NULL,
user_name varchar(50) NOT NULL,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT linkis_ps_udf_shared_info_pkey PRIMARY KEY (id)
);

Expand All @@ -224,16 +278,18 @@ CREATE TABLE linkis_ps_udf_tree (
);
COMMENT ON COLUMN "linkis_ps_udf_tree"."name" IS 'Category name of the function. It would be displayed in the front-end';
COMMENT ON COLUMN "linkis_ps_udf_tree"."category" IS 'Used to distinguish between udf and function';

CREATE UNIQUE INDEX uniq_parent_name_uname_category ON linkis_ps_udf_tree USING btree (parent,name,user_name,category);

DROP TABLE IF EXISTS "linkis_ps_udf_user_load";
CREATE TABLE linkis_ps_udf_user_load (
id bigserial NOT NULL,
udf_id int4 NOT NULL,
user_name varchar(50) NOT NULL,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT linkis_ps_udf_user_load_pkey PRIMARY KEY (id)
);

CREATE UNIQUE INDEX uniq_uid_uname ON linkis_ps_udf_user_load USING btree (udf_id, user_name);

DROP TABLE IF EXISTS "linkis_ps_udf_baseinfo";
CREATE TABLE linkis_ps_udf_baseinfo (
Expand Down Expand Up @@ -264,6 +320,7 @@ CREATE TABLE linkis_ps_udf_version (
use_format varchar(255) NULL,
description varchar(255) NOT NULL,
create_time timestamptz(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP,
md5 varchar(100) NULL,
CONSTRAINT linkis_ps_udf_version_pkey PRIMARY KEY (id)
);
Expand Down Expand Up @@ -509,7 +566,7 @@ COMMENT ON COLUMN "linkis_ps_bml_resources"."max_version" IS '默认为10,指
COMMENT ON COLUMN "linkis_ps_bml_resources"."update_time" IS '更新时间';
COMMENT ON COLUMN "linkis_ps_bml_resources"."updator" IS '更新者';
COMMENT ON COLUMN "linkis_ps_bml_resources"."enable_flag" IS '状态,1:正常,0:冻结';

CREATE UNIQUE INDEX uniq_rid_eflag ON linkis_ps_bml_resources USING btree (resource_id, enable_flag);

DROP TABLE IF EXISTS "linkis_ps_bml_resources_version";
CREATE TABLE linkis_ps_bml_resources_version (
Expand Down
Loading

0 comments on commit 3983c0e

Please sign in to comment.