https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33905

--- Comment #29 from David Cook <[email protected]> ---
(In reply to Tomás Cohen Arazi (tcohen) from comment #28)
> I still think dcook has a point on this generating a couple extra queries on
> each INSERT/UPDATE. Having a separate table with a simple UNIQUE constraint
> could work too, but would imply breaking reports and I've heard of people
> wanting userid=cardnumber in some scenarios which wouldn't work well with
> the UNIQUE constraint (i.e. we would end up doing it in the code again or
> having the need of a trigger).

After some chatting on Mattermost and some braining, I think I might have a new
idea which leverages both DB referential integrity and uniqueness while also
relying on application code for the actual logic.

Basically, the borrowers table stays essentially the same, but we change the
constraints on the cardnumber and userid. 

We also create a new "identifiers" table (the name can be something else I
don't care), which has a UNIQUE constraint on the identifier, so that the
particular identifier can only exist 1 time in that table. 

The cleverness here is that the borrowers table can reference that unique
identifier more than once for the *same* borrowernumber. I'll post the SQL in a
separate comment.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to