Hey 👋, does anyone know if there is a way with cascading deletes to change relations for userID to a default userID? or would i have to change to set to null?
Just had an admin of an app leave a company and their account was deleted and it deleted all the posts she created that they would've like to stay like. Trying to figure out how to make sure posts aren't deleted when the publishing admin is removed from the DB.
Thanks!
a
Austin Zentz
01/31/2022, 9:46 PM
I think you could set it up as onDelete: setNull, and then have some kind of cron job that finds every record whose userID is null and sets it to a "deletedUsers" type of account
Austin Zentz
01/31/2022, 9:46 PM
alternatively, you could also do onDelete: setDefault, but you'd have to set the default to the generic UserID account ID, which may be operationally challenging since that account ID is going to vary
j
Jon Insley
02/01/2022, 4:41 PM
@Austin Zentz thanks! Both are good ideas. I could setup a default admin account that would never change in order to use it as the default fallback userID.