Files
MyAiDesk/GovAI/server/migrations/seed_fazhiwang_users.sql
freedak f7a720204a Update: 将子项目从 submodule 转为完整内容
- 移除 GovAI, nomifun-tauri, 算力盒子 的 submodule 引用
- 添加所有子项目的完整源代码
- 保留原始 .git 为 .git.bak 备份
2026-07-04 19:20:46 +08:00

39 lines
1.9 KiB
SQL
Raw Permalink 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
DO $$
DECLARE
pwd_hash TEXT;
fazhi_org UUID := 'a0000000-0000-0000-0000-00000000000a';
BEGIN
-- 获取已有用户的密码hashadmin123
SELECT password_hash INTO pwd_hash FROM users WHERE email = 'admin@govai.gov.cn';
-- 法治网机构管理员(排序第一位,作为登录页默认账号)
INSERT INTO organizations (id, name, slug, short_name, description, sort_order, is_active) VALUES
(fazhi_org, '法治网', 'fazhiwang', '法治网',
'法治网官方平台,提供法治资讯、政策解读、法律服务与智能应用',
1, true)
ON CONFLICT (id) DO NOTHING;
-- 显式重排所有机构,确保法治网稳定排在第一位、其余机构顺延(幂等)
UPDATE organizations SET sort_order = 1 WHERE slug = 'fazhiwang';
UPDATE organizations SET sort_order = 2 WHERE slug = 'keji';
UPDATE organizations SET sort_order = 3 WHERE slug = 'gongan';
UPDATE organizations SET sort_order = 4 WHERE slug = 'fagai';
UPDATE organizations SET sort_order = 5 WHERE slug = 'jiaoyu';
UPDATE organizations SET sort_order = 6 WHERE slug = 'renshe';
UPDATE organizations SET sort_order = 7 WHERE slug = 'caizheng';
UPDATE organizations SET sort_order = 8 WHERE slug = 'zhujian';
UPDATE organizations SET sort_order = 9 WHERE slug = 'shijianju';
UPDATE organizations SET sort_order = 10 WHERE slug = 'lvsuo';
-- 法治网机构用户
INSERT INTO users (id, name, email, password_hash, role, status, org_id) VALUES
(gen_random_uuid(), '法治网管理员', 'fazhiwang@govai.gov.cn', pwd_hash, 'admin', 'active', fazhi_org),
(gen_random_uuid(), '法治网编辑', 'fazhibian@govai.gov.cn', pwd_hash, 'creator', 'active', fazhi_org),
(gen_random_uuid(), '法治网记者', 'fazhijizhe@govai.gov.cn', pwd_hash, 'user', 'active', fazhi_org)
ON CONFLICT (email) DO NOTHING;
END $$;