Files
GovAI/server/migrations/seed_fayuan.sql
T
2026-07-27 14:11:32 +08:00

42 lines
1.5 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 人民法院机构 + 用户种子数据
-- 密码统一为 admin123
-- 可重复执行(ON CONFLICT DO NOTHING
-- 1. 创建法院机构
INSERT INTO organizations (id, name, slug, short_name, description, logo_url, sort_order, is_active)
VALUES (
'a0000000-0000-0000-0000-000000000011',
'人民法院',
'fayuan',
'法院',
'人民法院司法智能应用平台,覆盖立案、送达、庭审、裁判、执行、审判管理等全流程AI辅助',
'',
11,
true
) ON CONFLICT (id) DO NOTHING;
-- 2. 创建法院用户(密码同 admin123)
DO $$
DECLARE
pwd_hash TEXT;
fayuan_org UUID := 'a0000000-0000-0000-0000-000000000011';
BEGIN
SELECT password_hash INTO pwd_hash FROM users WHERE email = 'admin@govai.gov.cn';
-- 法院管理员
INSERT INTO users (id, name, email, password_hash, role, status, org_id) VALUES
(gen_random_uuid(), '法院管理员', 'fayuan-admin@govai.gov.cn', pwd_hash, 'admin', 'active', fayuan_org)
ON CONFLICT (email) DO NOTHING;
-- 法官(creator
INSERT INTO users (id, name, email, password_hash, role, status, org_id) VALUES
(gen_random_uuid(), '李法官', 'lifaguan@govai.gov.cn', pwd_hash, 'creator', 'active', fayuan_org)
ON CONFLICT (email) DO NOTHING;
-- 书记员(user
INSERT INTO users (id, name, email, password_hash, role, status, org_id) VALUES
(gen_random_uuid(), '王书记员', 'wangshujiyuan@govai.gov.cn', pwd_hash, 'user', 'active', fayuan_org)
ON CONFLICT (email) DO NOTHING;
END $$;