20 lines
591 B
PL/PgSQL
20 lines
591 B
PL/PgSQL
BEGIN;
|
|
|
|
-- Remove system user from department (cascade should handle this, but being explicit)
|
|
DELETE FROM user_department
|
|
WHERE user_id = '11111111-2222-3333-4444-555555555555'::uuid
|
|
AND department_id = '11111111-2222-3333-4444-555555555555'::uuid;
|
|
|
|
-- Remove system user profile
|
|
DELETE FROM user_profiles
|
|
WHERE user_id = '11111111-2222-3333-4444-555555555555'::uuid;
|
|
|
|
-- Remove system user
|
|
DELETE FROM users
|
|
WHERE id = '11111111-2222-3333-4444-555555555555'::uuid;
|
|
|
|
-- Remove system department
|
|
DELETE FROM departments
|
|
WHERE id = '11111111-2222-3333-4444-555555555555'::uuid;
|
|
|
|
COMMIT; |