top | item 32160334

(no title)

dubswithus | 3 years ago

There are Rails gems that can handle this in various ways.

But the easiest way is to deactivate the user account (is_active boolean) and continue to reference the user in internal records.

discuss

order

whoomp12342|3 years ago

thats exactly their point, is_active or deleted_at represents the same thing(just inverse).

However, if you DONT use an active/deleted flag, and instead do what the author suggests, I dont know the right way to support deleting said user

If you set the deleted_record table as part of a trigger on delete of other tables, you could turn on cascading delete and hope for the best. Outside of that I dont have any plan for using this with referential integrty.

It would be easy enough if you decided NOT to use referential integrity, but then you save the space of ONE user record and retain how many orphan records, making them all effectively soft deleted anyways... whats the point?