mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-06-25 07:27:42 +00:00
Verified changes: - add backend/migrations/20260128113000_moderation_ledger_delete_guard_fix.sql - rename backend/migrations/20260127150000_demo_seed_data.sql -> backend/migrations_demo/20260127150000_demo_seed_data.sql - add backend/migrations_demo/20260128114000_demo_moderation_log_deterministic_ids.sql - add backend/migrations_demo/20260128115000_demo_seed_user_roles.sql - add backend/migrations_demo/20260128130000_demo_convert_topic_delegations_to_community.sql Diffstat: - 5 files changed, 114 insertions(+)
16 lines
746 B
SQL
16 lines
746 B
SQL
-- Ensure demo-seeded users have baseline platform roles for permission checks.
|
|
|
|
-- Give all demo-seeded users the base 'user' platform role
|
|
INSERT INTO user_roles (user_id, role_id, community_id, granted_by)
|
|
SELECT u.id, r.id, NULL, u.id
|
|
FROM users u
|
|
JOIN roles r ON r.name = 'user' AND r.community_id IS NULL
|
|
WHERE u.id::text LIKE 'd000%'
|
|
ON CONFLICT (user_id, role_id, community_id) DO NOTHING;
|
|
|
|
-- Make demo moderator a platform admin
|
|
INSERT INTO user_roles (user_id, role_id, community_id, granted_by)
|
|
SELECT 'd0000001-0000-0000-0000-000000000002'::uuid, r.id, NULL, 'd0000001-0000-0000-0000-000000000002'::uuid
|
|
FROM roles r
|
|
WHERE r.name = 'platform_admin' AND r.community_id IS NULL
|
|
ON CONFLICT (user_id, role_id, community_id) DO NOTHING;
|