robmaceachern / cpsc304

Our sweet 304 project
1 stars 1 forks source link

Constraint between borrowing.inDate and bookCopy.status #9

Open robmaceachern opened 12 years ago

robmaceachern commented 12 years ago

I think we should add some kind of constraint between borrowing.inDate and bookCopy.status.

It seems odd that you could have a bookCopy marked as out without any corresponding borrowing...

or have a bookCopy with status 'in' and associated with an active borrowing.

robmaceachern commented 12 years ago

@rc9 and @rkw10 for comment

rc9 commented 12 years ago

i suppose it would be good to have, though I can't think of a SQL way to handle it...it's mostly up to implementation to ensure that only when a copy is borrowed it gets set to 'out' and 'in' when returned.

robmaceachern commented 12 years ago

I was wondering if assertions might be applicable here:

http://www.ugrad.cs.ubc.ca/~cs304/2011W1/notes/Unit06-SQL-2up.pdf slide 54