[Koha-devel] [DISCUSSION] Database schema & coding guidelines

Paul Poulain paul.poulain at biblibre.com
Wed Jun 6 13:24:14 CEST 2012


Le 25/05/2012 18:23, Marc Balmer a écrit :
> I contradict.  This results neither in complexity nor in mistakes.
> Imagine two tables, A and B, which both have an id column, then a select
> would probably look like the following:
> 
> select A.id as aid, B.id as bid from A, B, where ...
> 
> So it's not a problem.

I contradict your contradiction.
If you have branches.id as identifier, then, the FK in borrowers table
(the branch of the patron) can't be id, as, in your proposition, the
identifier of the borrower will be borrower.id

It means instead of :
borrowers(borrower_id,surname,firstname,branch_id) /
branches(branch_id,name) / SELECT * FROM borrowers LEFT JOIN branches
USING(branch_id) and use all field in a hash, your option would result in:

borrowers(id,surname,firstname,branch_fk_id) / branches(id,name) /
SELECT borrowers.*,branches.id as bid,branches.name LEFT JOIN branches
ON (borrowers.branch_fk_id,branches.id), and deal with bid as a hash entry.

So, depending on the part of Koha you'll refer to $borrowers->{bid} or
$branch->{id}

I can't imagine a second that would be easier to read. No gain, big
loss, this option must be forgotten according to me.

-- 
Paul POULAIN
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
Tel : (33) 4 91 81 35 08


More information about the Koha-devel mailing list