When a new subscription is created in the serials module, the userid of the staff member is saved to subscripiton.librarian. This makes subscription the only table to store information about the patron not using the borrowernumber, but the userid instead. If you delete the staff member, his/her userid will stay in the subscription forever.
Also, if the userid changes, the information in the subscription table might get useless.
Can we envisage to simply remove this column?
We save the creator in lots of places, maybe we could replaces it with a creator/user... whatever that has a FK on borrowers with a SET NULL on deletion of the borrower? We could also look up the userid visible in the borrowers and deletedborrowers tables ... but that might not always lead to a correct borrowernumber (userid could have been reused... not sure if that happens often). A bit worried a library might complain, but at the same time I am not sure how useful it is to save the initial creator - if someone changes the subscription afer, noone will know.
It is actually worst than that, it is using "loggedinusername" that is a concatenation of firstname and surname of the logged in librarian. This value is never displayed or reused anywhere else.
(In reply to Jonathan Druart from comment #4) > It is actually worst than that, it is using "loggedinusername" that is a > concatenation of firstname and surname of the logged in librarian. > > This value is never displayed or reused anywhere else. This is wrong, it's the userid!
Could we try to replace userid with borrowernumber by lookup in borrowers and deletedborrowers?