From 7c4329579ffea58db162c7273b2d371b67ffdb56 Mon Sep 17 00:00:00 2001 From: Zzm0809 <934230207@qq.com> Date: Thu, 5 Dec 2024 14:42:03 +0800 Subject: [PATCH] [Bug] Fix pg bug (#4009) Co-authored-by: Zzm0809 Co-authored-by: GH Action - Upstream Sync --- .../dinky/configure/MybatisPlusConfig.java | 4 +- .../postgresql/V20241205.1.2.0__release.sql | 329 ++++++++++++++++++ .../Home/components/MyWorker/MyWorker.tsx | 3 +- dinky-web/src/pages/Home/index.tsx | 8 +- .../AlertRuleList/RuleEditForm/index.tsx | 2 +- 5 files changed, 339 insertions(+), 7 deletions(-) create mode 100644 dinky-admin/src/main/resources/db/migration/postgresql/V20241205.1.2.0__release.sql diff --git a/dinky-admin/src/main/java/org/dinky/configure/MybatisPlusConfig.java b/dinky-admin/src/main/java/org/dinky/configure/MybatisPlusConfig.java index 96ae498282..685adc9c87 100644 --- a/dinky-admin/src/main/java/org/dinky/configure/MybatisPlusConfig.java +++ b/dinky-admin/src/main/java/org/dinky/configure/MybatisPlusConfig.java @@ -80,7 +80,7 @@ public class MybatisPlusConfig { "dinky_task_version"); @Bean - @Profile("pgsql") + @Profile("postgresql") public PostgreSQLQueryInterceptor postgreSQLQueryInterceptor() { return new PostgreSQLQueryInterceptor(); } @@ -91,7 +91,7 @@ public PostgreSQLQueryInterceptor postgreSQLQueryInterceptor() { * @return {@linkplain PostgreSQLPrepareInterceptor} */ @Bean - @Profile("pgsql") + @Profile("postgresql") public PostgreSQLPrepareInterceptor postgreSQLPrepareInterceptor() { return new PostgreSQLPrepareInterceptor(); } diff --git a/dinky-admin/src/main/resources/db/migration/postgresql/V20241205.1.2.0__release.sql b/dinky-admin/src/main/resources/db/migration/postgresql/V20241205.1.2.0__release.sql new file mode 100644 index 0000000000..21e17a6a61 --- /dev/null +++ b/dinky-admin/src/main/resources/db/migration/postgresql/V20241205.1.2.0__release.sql @@ -0,0 +1,329 @@ + +CREATE OR REPLACE TRIGGER set_update_time_dinky_user + BEFORE UPDATE + ON public.dinky_user + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + + + + +-- Table structure for public.dinky_resources +CREATE TABLE IF NOT EXISTS public.dinky_resources_backup +( + id SERIAL PRIMARY KEY NOT NULL, + file_name VARCHAR(64), + description VARCHAR(255), + user_id INT, + type SMALLINT, + size BIGINT, + pid INT, + full_name VARCHAR(255), + is_directory boolean, + create_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator INT, + updater INT +); + +CREATE UNIQUE INDEX IF NOT EXISTS dinky_resources_un1 ON public.dinky_resources_backup (full_name, type); + +COMMENT ON TABLE public.dinky_resources_backup IS 'resources'; + +COMMENT ON COLUMN public.dinky_resources_backup.id IS 'key'; +COMMENT ON COLUMN public.dinky_resources_backup.file_name IS 'file name'; +COMMENT ON COLUMN public.dinky_resources_backup.user_id IS 'user id'; +COMMENT ON COLUMN public.dinky_resources_backup.type IS 'resource type,0:FILEļ¼Œ1:UDF'; +COMMENT ON COLUMN public.dinky_resources_backup.size IS 'resource size'; + +-- public.dinky_git_project +CREATE OR REPLACE TRIGGER update_dinky_dinky_resources + BEFORE UPDATE + ON public.dinky_resources_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + +insert into public.dinky_resources_backup(id, file_name, description, user_id, type, size, pid, full_name, is_directory, create_time, update_time, creator, updater) +select id, file_name, description, user_id, type, size, pid, full_name, + case when is_directory = 0 then false else true end as is_directory + , create_time, update_time, creator, updater +from public.dinky_resources; + +drop table if exists public.dinky_resources; +alter table public.dinky_resources_backup rename to dinky_resources; + + + + + + + +-- ---------------------------- +-- Table structure for public.dinky_alert_instance +-- ---------------------------- + + +CREATE TABLE IF NOT EXISTS public.dinky_alert_instance_backup +( + id SERIAL PRIMARY KEY NOT NULL, + name VARCHAR(50) NOT NULL, + tenant_id INT NOT NULL DEFAULT 1, + type VARCHAR(50), + params TEXT, + enabled boolean DEFAULT false, + create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator INT DEFAULT NULL, + updater INT DEFAULT NULL, + UNIQUE (name, tenant_id) +); + +COMMENT + ON COLUMN public.dinky_alert_instance_backup.id IS 'id'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.name IS 'alert instance name'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.tenant_id IS 'tenant id'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.type IS 'alert instance type such as: DingTalk,Wechat(Webhook,app) Feishu ,email'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.params IS 'configuration'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.enabled IS 'is enable'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.create_time IS 'create time'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.update_time IS 'update time'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.creator IS 'creator user id'; +COMMENT + ON COLUMN public.dinky_alert_instance_backup.updater IS 'updater user id'; +COMMENT + ON TABLE public.dinky_alert_instance_backup IS 'Alert instance'; + + +CREATE OR REPLACE TRIGGER set_update_time_dinky_alert_instance + BEFORE UPDATE + ON public.dinky_alert_instance_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + + +insert into public.dinky_alert_instance_backup(id, name, tenant_id, type, params, enabled, create_time, update_time, creator, updater) +select id, name, tenant_id, type, params, + case when enabled = 0 then false else true end as enabled + , create_time, update_time, creator, updater +from public.dinky_alert_instance; + +drop table if exists public.dinky_alert_instance; +alter table public.dinky_alert_instance_backup rename to dinky_alert_instance; + + + + + + + + + +-- ---------------------------- +-- Table structure for public.dinky_alert_group +-- ---------------------------- + +CREATE TABLE IF NOT EXISTS public.dinky_alert_group_backup +( + id SERIAL PRIMARY KEY NOT NULL, + name VARCHAR(50) NOT NULL, + tenant_id INT NOT NULL DEFAULT 1, + alert_instance_ids TEXT, + note VARCHAR(255) DEFAULT NULL, + enabled boolean DEFAULT false, + create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator INT DEFAULT NULL, + updater INT DEFAULT NULL, + CONSTRAINT alert_group_un_idx UNIQUE (name, tenant_id) +); + +COMMENT + ON COLUMN public.dinky_alert_group_backup.id IS 'id'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.name IS 'alert group name'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.tenant_id IS 'tenant id'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.alert_instance_ids IS 'Alert instance IDS'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.note IS 'note'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.enabled IS 'is enable'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.create_time IS 'create time'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.update_time IS 'update time'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.creator IS 'creator user id'; +COMMENT + ON COLUMN public.dinky_alert_group_backup.updater IS 'updater user id'; +COMMENT + ON TABLE public.dinky_alert_group_backup IS 'Alert group'; + +CREATE OR REPLACE TRIGGER set_update_time_dinky_alert_group + BEFORE UPDATE + ON public.dinky_alert_group_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + +insert into public.dinky_alert_group_backup(id, name, tenant_id, alert_instance_ids, note, enabled, create_time, update_time, creator, updater) +select id, name, tenant_id, alert_instance_ids, note, + case when enabled = 0 then false else true end as enabled + , create_time, update_time, creator, updater +from public.dinky_alert_group; +drop table if exists public.dinky_alert_group; +alter table public.dinky_alert_group_backup rename to dinky_alert_group; + + + + +-- ---------------------------- +-- Table structure for public.dinky_alert_template +-- ---------------------------- +CREATE TABLE IF NOT EXISTS public.dinky_alert_template_backup +( + id SERIAL PRIMARY KEY NOT NULL, + name VARCHAR(20), + template_content TEXT, + enabled boolean DEFAULT false, + create_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator INT, + updater INT, + CONSTRAINT dinky_alert_template_unx_idx UNIQUE (name) +); + +COMMENT ON COLUMN public.dinky_alert_template_backup.id IS 'id'; +COMMENT ON COLUMN public.dinky_alert_template_backup.name IS 'emplate name'; +COMMENT ON COLUMN public.dinky_alert_template_backup.template_content IS 'template content'; +COMMENT ON COLUMN public.dinky_alert_template_backup.enabled IS 'is enable'; +-- public.dinky_git_project +CREATE OR REPLACE TRIGGER update_dinky_alert_template + BEFORE UPDATE + ON public.dinky_alert_template_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + +insert into public.dinky_alert_template_backup(id, name, template_content, enabled, create_time, update_time, creator, updater) +select id, name, template_content, + case when enabled = 0 then false else true end as enabled + , create_time, update_time, creator, updater +from public.dinky_alert_template; +drop table if exists public.dinky_alert_template; +alter table public.dinky_alert_template_backup rename to dinky_alert_template; + + + + +-- ---------------------------- +-- Table structure for public.dinky_alert_rules +-- ---------------------------- +CREATE TABLE IF NOT EXISTS public.dinky_alert_rules_backup +( + id SERIAL PRIMARY KEY, + name VARCHAR(40) NOT NULL, + rule TEXT, + template_id INT, + rule_type VARCHAR(10), + trigger_conditions VARCHAR(20), + description TEXT, + enabled boolean DEFAULT false, + create_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator INT, + updater INT +); +CREATE UNIQUE INDEX IF NOT EXISTS dinky_alert_rules_name_unx ON public.dinky_alert_rules (name); + +COMMENT ON COLUMN public.dinky_alert_rules_backup.id IS 'id'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.name IS 'rule name'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.rule IS 'specify rule'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.template_id IS 'template id'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.rule_type IS 'alert rule type'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.trigger_conditions IS 'trigger conditions'; +COMMENT ON COLUMN public.dinky_alert_rules_backup.description IS 'description'; + +-- public.dinky_git_project +CREATE OR REPLACE TRIGGER update_dinky_alert_rules + BEFORE UPDATE + ON public.dinky_alert_rules_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + + +insert into public.dinky_alert_rules_backup(id, name, rule, template_id, rule_type, trigger_conditions, description, enabled, create_time, update_time, creator, updater) +select id, name, rule, template_id, rule_type, trigger_conditions, description, + case when enabled = 0 then false else true end as enabled + , create_time, update_time, creator, updater +from public.dinky_alert_rules; +drop table if exists public.dinky_alert_rules; +alter table public.dinky_alert_rules_backup rename to dinky_alert_rules; + + + + + +-- ---------------------------- +-- Table structure for public.dinky_fragment +-- ---------------------------- + +CREATE TABLE IF NOT EXISTS public.dinky_fragment_backup +( + id serial PRIMARY KEY NOT NULL, + name varchar(50) NOT NULL, + tenant_id int NOT NULL DEFAULT 1, + fragment_value text NOT NULL, + note text, + enabled boolean DEFAULT false, + create_time timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + update_time timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, + creator int, + updater int, + UNIQUE (name, tenant_id) +); + +COMMENT ON TABLE public.dinky_fragment_backup is 'fragment management'; +COMMENT ON COLUMN public.dinky_fragment_backup.id is 'id'; +COMMENT ON COLUMN public.dinky_fragment_backup.name is 'fragment name'; +COMMENT ON COLUMN public.dinky_fragment_backup.tenant_id is 'tenant id'; +COMMENT ON COLUMN public.dinky_fragment_backup.fragment_value is 'fragment value'; +COMMENT ON COLUMN public.dinky_fragment_backup.note is 'note'; +COMMENT ON COLUMN public.dinky_fragment_backup.enabled is 'enabled'; +COMMENT ON COLUMN public.dinky_fragment_backup.create_time is 'create time'; +COMMENT ON COLUMN public.dinky_fragment_backup.update_time is 'update time'; +COMMENT ON COLUMN public.dinky_fragment_backup.creator is 'creator'; +COMMENT ON COLUMN public.dinky_fragment_backup.updater is 'updater'; + +CREATE OR REPLACE TRIGGER update_dinky_fragment_modtime + BEFORE UPDATE + ON public.dinky_fragment_backup + FOR EACH ROW +EXECUTE FUNCTION trigger_set_timestamp(); + +insert into public.dinky_fragment_backup(id, name, tenant_id, fragment_value, note, enabled, create_time, update_time, creator, updater) +select id, name, tenant_id, fragment_value, note, + case when enabled = 0 then false else true end as enabled + , create_time, update_time, creator, updater +from public.dinky_fragment; +drop table if exists public.dinky_fragment; +alter table public.dinky_fragment_backup rename to dinky_fragment; + + + + + + + + + + + + diff --git a/dinky-web/src/pages/Home/components/MyWorker/MyWorker.tsx b/dinky-web/src/pages/Home/components/MyWorker/MyWorker.tsx index 93c0f66548..46f1ec6384 100644 --- a/dinky-web/src/pages/Home/components/MyWorker/MyWorker.tsx +++ b/dinky-web/src/pages/Home/components/MyWorker/MyWorker.tsx @@ -51,7 +51,8 @@ const MyWorker = () => { return ( { }; return ( - + @@ -96,8 +96,10 @@ const Workplace: FC = () => { // size={"small"} title={l('home.fast.link')} bordered={false} - bodyStyle={{ - padding: 0 + styles={{ + body: { + padding: 0 + } }} > diff --git a/dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx b/dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx index 90317d1cb9..1ea4352116 100644 --- a/dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx +++ b/dinky-web/src/pages/RegCenter/Alert/AlertRule/AlertRuleList/RuleEditForm/index.tsx @@ -111,7 +111,7 @@ const RuleEditForm = (props: AlertRuleFormProps) => { [...renderFooter()] }} drawerProps={{