RaythaHQ / raytha

Raytha is a powerful CMS with an easy-to-use interface and fast performance. It offers custom content types, a template engine, and various access controls. It supports multiple storage providers and an automatically generated REST API. Upgrade your development workflow with Raytha.
MIT License
155 stars 30 forks source link

Crash when deleting admin that has a content revision #199

Closed apexdodge closed 1 week ago

apexdodge commented 1 month ago

Receiving the following crash log when attempting to delete an admin:

Raytha.Application.Admins.Commands.DeleteAdmin.Command: Error: Raytha Request: Unhandled Exception for Request Command Command { Id = G-1Gc2l1OEOrsstm2wXiow }

Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.SqlClient.SqlException (0x80131904): The DELETE statement conflicted with the REFERENCE constraint "FK_ContentItemRevisions_Users_CreatorUserId". The conflict occurred in database "Raytha", table "dbo.ContentItemRevisions", column 'CreatorUserId'.

The admin being deleted has modified existing content items. I believe the ContentRevisions table that has a relationship with the admin has this reference issue.