Keep allocation history after deleting a user

97 views Asked by At

I have 3 tables - user, book and bookissues

When a user is deleted I want to keep the bookissues associated with the user (for book records). I also want to know what the users name and email was.

What would be the best solution for this?

Using redbean for ORM

2

There are 2 answers

0
wesside On BEST ANSWER

Do a "soft" delete. Make a 'deleted' flag in the users table.

Laravel has a good example of how this is done. http://laravel.com/docs/eloquent#soft-deleting

0
zewa666 On

You can also use automated revisions to keep your main tables clean. Take a look at the rebean Plugin here https://github.com/zewa666/RedBean_ReBean