mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-19 13:08:23 +02:00
Update user deletion to reassign roles and fix foreign key constraint violations
Update the deleteUser function in DatabaseStorage to reassign roles assigned by the deleted user to the admin user, resolving a foreign key constraint error when deleting the 'system' user. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/vetH0Gp
This commit is contained in:
1 parent
c24e19da52
commit
fd92ce25d0
3 files changed
+115
-1
No files matched your search
+108
@@ -0,0 +1,108 @@
|
||||
GET /api/users 200 in 33ms
|
||||
|
||||
Error deleting user: error: update or delete on table "users" violates foreign key constraint "user_roles_assigned_by_fkey" on table "user_roles"
|
||||
|
||||
at /app/node_modules/pg/lib/client.js:545:17
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/dist/index.js:1108:11
|
||||
|
||||
at async NodePgSession.transaction (file:///app/node_modules/drizzle-orm/node-postgres/session.js:142:22)
|
||||
|
||||
at async DatabaseStorage.deleteUser (file:///app/dist/index.js:1090:9)
|
||||
|
||||
at async file:///app/dist/index.js:4094:7 {
|
||||
|
||||
length: 299,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '23503',
|
||||
|
||||
detail: 'Key (id)=(system) is still referenced from table "user_roles".',
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: undefined,
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: 'public',
|
||||
|
||||
table: 'user_roles',
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: 'user_roles_assigned_by_fkey',
|
||||
|
||||
file: 'ri_triggers.c',
|
||||
|
||||
line: '2609',
|
||||
|
||||
routine: 'ri_ReportViolation'
|
||||
|
||||
}
|
||||
|
||||
DELETE /api/users/system 500 in 29ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
Error deleting user: error: update or delete on table "users" violates foreign key constraint "user_roles_assigned_by_fkey" on table "user_roles"
|
||||
|
||||
at /app/node_modules/pg/lib/client.js:545:17
|
||||
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
|
||||
|
||||
at async file:///app/dist/index.js:1108:11
|
||||
|
||||
at async NodePgSession.transaction (file:///app/node_modules/drizzle-orm/node-postgres/session.js:142:22)
|
||||
|
||||
at async DatabaseStorage.deleteUser (file:///app/dist/index.js:1090:9)
|
||||
|
||||
at async file:///app/dist/index.js:4094:7 {
|
||||
|
||||
length: 299,
|
||||
|
||||
severity: 'ERROR',
|
||||
|
||||
code: '23503',
|
||||
|
||||
detail: 'Key (id)=(system) is still referenced from table "user_roles".',
|
||||
|
||||
hint: undefined,
|
||||
|
||||
position: undefined,
|
||||
|
||||
internalPosition: undefined,
|
||||
|
||||
internalQuery: undefined,
|
||||
|
||||
where: undefined,
|
||||
|
||||
schema: 'public',
|
||||
|
||||
table: 'user_roles',
|
||||
|
||||
column: undefined,
|
||||
|
||||
dataType: undefined,
|
||||
|
||||
constraint: 'user_roles_assigned_by_fkey',
|
||||
|
||||
file: 'ri_triggers.c',
|
||||
|
||||
line: '2609',
|
||||
|
||||
routine: 'ri_ReportViolation'
|
||||
|
||||
}
|
||||
|
||||
DELETE /api/users/system 500 in 19ms
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 205 KiB |
Reference in new issue
Block a user