From e5ae5f61b59f2bec8a512cae46ce2eb158004e8f Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 29 Jan 2026 09:15:56 +0800 Subject: [PATCH] style: reformat init.sql --- database/init.d/init-en_GB.sql | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/database/init.d/init-en_GB.sql b/database/init.d/init-en_GB.sql index 44e9727..231b269 100644 --- a/database/init.d/init-en_GB.sql +++ b/database/init.d/init-en_GB.sql @@ -335,9 +335,30 @@ CREATE TABLE menus CREATE UNIQUE INDEX menus_code_uindex ON menus (code); -INSERT INTO menus(id, name, parent_id, code, sort, path, is_external_link, is_visible, status, - authority_code, icon, created_at, updated_at) -VALUES (1, '系统管理', NULL, 'system-manage', 99, NULL, FALSE, TRUE, 'ACTIVE'::STATUS, NULL, NULL, - NOW(), NOW()), - (2, '用户管理', 1, 'user-manage', 1, '/users', FALSE, TRUE, 'ACTIVE'::STATUS, - 'system:user:write', NULL, NOW(), NOW()); \ No newline at end of file +WITH system_menu AS ( + INSERT INTO menus (name, parent_id, code, sort, path, is_external_link, is_visible, status, + authority_code, icon, created_at, updated_at) + VALUES ('系统管理', NULL, 'system-mgmt', 99, NULL, FALSE, TRUE, 'ACTIVE'::STATUS, NULL, + NULL, NOW(), NOW()) + RETURNING id) +INSERT +INTO menus(name, parent_id, code, sort, path, is_external_link, is_visible, status, + authority_code, icon, created_at, updated_at) +SELECT '用户管理', + system_menu.id, + 'user-mgmt', + 1, + '/users', + FALSE, + TRUE, + 'ACTIVE'::STATUS, + 'system:user:write', + NULL, + NOW(), + NOW() +FROM system_menu; + +INSERT INTO menus (name, parent_id, code, sort, path, is_external_link, is_visible, status, + authority_code, icon, created_at, updated_at) +VALUES ('Helix 官网', null, 'helix-official-site', 100, 'https://helix.onixbyte.com', true, true, + 'ACTIVE'::STATUS, null, null, NOW(), NOW()); \ No newline at end of file