Skip to content

Commit 2a03088

Browse files
authored
Add comments to explain why assets and level revisions are not cascade-deleted
Signed-off-by: ToasterTheBrot <95178340+Toastbrot236@users.noreply.github.com>
1 parent d92bb08 commit 2a03088

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Refresh.Database/GameDatabaseContext.Users.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ public void FullyDeleteUser(GameUser user)
391391
this.DeleteUser(user);
392392

393393
// Set asset uploader to null to avoid EF throwing when fully deleting the original uploader outside of unit tests.
394+
// No cascade-delete because currently, there's no way to delete assets from the data store, because doing so
395+
// was ruled to be dangerous due to the risk of accidentally causing in-game issues due to no longer available assets
396+
// (this risk is practically minimal, so this ruling is likely to change in the future).
397+
// Also, moderation may be an argument for not cascade-deleting assets.
394398
// TODO: Store ID or name of the uploader separately/in a way where it won't be removed when deleting the user.
395399
IEnumerable<GameAsset> assets = this.GetAssetsUploadedByUserInternal(user).ToArray();
396400
foreach(GameAsset asset in assets)
@@ -399,7 +403,8 @@ public void FullyDeleteUser(GameUser user)
399403
}
400404
this.UpdateAssetsInDatabase(assets);
401405

402-
// Same applies to level revisions
406+
// Same applies to level revisions.
407+
// These are not cascade-deleted because GameLevels aren't either; their publisher is set to null and shown as !Deleted.
403408
IEnumerable<GameLevelRevision> levelRevisions = this.GetLevelRevisionsByUserInternal(user).ToArray();
404409
foreach(GameLevelRevision levelRevision in levelRevisions)
405410
{
@@ -558,4 +563,4 @@ public void ResetTimedLevelLimit(GameUser user)
558563
user.TimedLevelUploads = 0;
559564
});
560565
}
561-
}
566+
}

0 commit comments

Comments
 (0)