Skip to content

Commit

Permalink
[Fix][admin] Fix the SQL auto initialization issue of PG (DataLinkDC#…
Browse files Browse the repository at this point in the history
…3756)

Signed-off-by: Zzm0809 <[email protected]>
  • Loading branch information
Zzm0809 authored Aug 28, 2024
1 parent c7ca8e2 commit 7daedeb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3440,7 +3440,6 @@ EXECUTE FUNCTION trigger_set_timestamp();
-- ----------------------------
-- Records of public.dinky_sys_menu
-- ----------------------------
BEGIN;
-- insert into public.dinky_sys_menu
-- values (1, -1, '首页', '/home', './Home', 'home', 'HomeOutlined', 'C', 0, 1, '2023-08-11 14:06:52',
-- '2023-09-25 18:26:45', null);
Expand Down Expand Up @@ -3891,8 +3890,6 @@ insert into public.dinky_sys_menu
values (156, 150, ' 刷新', '/registration/datasource/detail/refresh', null, 'registration:datasource:detail:refresh',
'ReloadOutlined', 'F', 0, 154, '2024-01-18 22:13:47', '2024-01-18 22:13:47', null);

COMMIT;


-- ----------------------------
-- Table structure for public.dinky_sys_role_menu
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
INSERT INTO public.dinky_sys_menu (parent_id, name, path, component, perms, icon, type, display, order_num, create_time,
INSERT INTO public.dinky_sys_menu (id,parent_id, name, path, component, perms, icon, type, display, order_num, create_time,
update_time, note)
VALUES (-1, '工作台', '/home', './Home', 'home', 'HomeOutlined', 'C', 0, 1, '2024-07-29 11:53:38',
VALUES (157, -1, '工作台', '/home', './Home', 'home', 'HomeOutlined', 'C', 0, 1, '2024-07-29 11:53:38',
'2024-07-29 11:53:38', NULL);

INSERT INTO public.dinky_sys_menu (parent_id, name, path, component, perms, icon, type, display, order_num,
INSERT INTO public.dinky_sys_menu (id,parent_id, name, path, component, perms, icon, type, display, order_num,
create_time, update_time, note)
VALUES (164, '仪表盘列表', '/dashboard/list', './Dashboard', 'dashboard:list', 'UnorderedListOutlined', 'F', 0, 167,
VALUES (158 ,164, '仪表盘列表', '/dashboard/list', './Dashboard', 'dashboard:list', 'UnorderedListOutlined', 'F', 0, 167,
'2024-07-29 15:37:46', '2024-07-29 15:37:46', NULL);

UPDATE public.dinky_sys_menu
Expand All @@ -25,15 +25,15 @@ SET path = '/dashboard/list/view',
perms='dashboard:list:view'
WHERE path = '/dashboard/view';

INSERT INTO public.dinky_sys_menu (parent_id, name, path, component, perms, icon, type, display, order_num,
INSERT INTO public.dinky_sys_menu (id,parent_id, name, path, component, perms, icon, type, display, order_num,
create_time, update_time, note)
VALUES (164, '看板布局', '/dashboard/dashboard-layout', './Dashboard/DashboardLayout', 'dashboard:dashboard-layout',
VALUES (159, 164, '看板布局', '/dashboard/dashboard-layout', './Dashboard/DashboardLayout', 'dashboard:dashboard-layout',
'DashboardOutlined', 'F', 0, 168, '2024-07-29 16:16:45', '2024-07-29 16:17:28', NULL);
INSERT INTO public.dinky_sys_menu (parent_id, name, path, component, perms, icon, type, display, order_num,
INSERT INTO public.dinky_sys_menu (id,parent_id, name, path, component, perms, icon, type, display, order_num,
create_time, update_time, note)
VALUES (164, '添加看板', '/dashboard/chart/add', NULL, 'dashboard:chart:add', 'AreaChartOutlined', 'F', 0, 167,
VALUES (160, 164, '添加看板', '/dashboard/chart/add', NULL, 'dashboard:chart:add', 'AreaChartOutlined', 'F', 0, 167,
'2024-06-21 10:53:33', '2024-06-21 10:53:33', NULL);
INSERT INTO public.dinky_sys_menu (parent_id, name, path, component, perms, icon, type, display, order_num,
INSERT INTO public.dinky_sys_menu (id,parent_id, name, path, component, perms, icon, type, display, order_num,
create_time, update_time, note)
VALUES (164, '修改看板', '/dashboard/chart/edit', NULL, 'dashboard:chart:edit', 'BarChartOutlined', 'F', 0, 168,
VALUES (161, 164, '修改看板', '/dashboard/chart/edit', NULL, 'dashboard:chart:edit', 'BarChartOutlined', 'F', 0, 168,
'2024-06-21 10:54:26', '2024-06-21 10:54:26', NULL);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CREATE OR REPLACE FUNCTION public.drop_index_if_exists(
DECLARE
index_exists int;
BEGIN
-- 检查索引是否存在
-- Check if the index exists
SELECT count(*)
INTO index_exists
FROM pg_indexes
Expand All @@ -23,4 +23,30 @@ END;
$$ LANGUAGE plpgsql;


SELECT public.drop_index_if_exists('public', 'cluster_un_idx1', 'dinky_cluster');
SELECT public.drop_index_if_exists('public', 'cluster_un_idx1', 'dinky_cluster');


CREATE TABLE IF NOT EXISTS public.dinky_dashboard
(
id SERIAL PRIMARY KEY NOT NULL,
name VARCHAR(255),
remark TEXT,
chart_theme VARCHAR(255),
layouts TEXT,
create_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);

COMMENT ON COLUMN public.dinky_dashboard.id IS 'ID';
COMMENT ON COLUMN public.dinky_dashboard.name IS 'name';
COMMENT ON COLUMN public.dinky_dashboard.remark IS 'remark';
COMMENT ON COLUMN public.dinky_dashboard.chart_theme IS 'chart theme';
COMMENT ON COLUMN public.dinky_dashboard.layouts IS 'layouts';
COMMENT ON COLUMN public.dinky_dashboard.create_time IS 'create time';
COMMENT ON COLUMN public.dinky_dashboard.update_time IS 'update time';

CREATE OR REPLACE TRIGGER update_dinky_dashboard_update_time
BEFORE UPDATE
ON public.dinky_dashboard
FOR EACH ROW
EXECUTE FUNCTION trigger_set_timestamp();

0 comments on commit 7daedeb

Please sign in to comment.