Replies: 4 comments 1 reply
-
This is an excellent question, but before I get to the meat of it allow me to comment on the setup overall. While we're on the subject of constraints, I would like to address this first:
Usually you want to avoid any form of uniqueness constraint on actual human names, because you might legitimately have more than one "Jane Smith" or whatever other common name. In case of library example I would actually recommend going with the Another note, this library scenario is a good case for using
|
Beta Was this translation helpful? Give feedback.
-
Regarding the question about
In practice it means that the system would only allow any given If you want to keep a record of past borrowings, then I suggest the same system actual libraries use: keep a record on each
The latter has the advantage of correctly expressing the situation where the same You may want to also imitate real life libraries and have a waiting queue of readers who want to borrow the same book:
I hope that you find this answer helpful even though doing what you explicitly requested is not possible. |
Beta Was this translation helpful? Give feedback.
-
Relating this to the more general idea you're asking about, if the reason for wanting to forbid overlapping "borrowing" of the same thing is that the actual things being borrowed are unique, limited and can only have one user at a time, then perhaps a plain |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for the detailed explanations and improvements you suggested for the library case. However, like you guessed, it is a proxy problem to my actual use case. |
Beta Was this translation helpful? Give feedback.
-
Hey there,
I would like to create dynamic links over time. Meaning each link got a time interval validity from
ts_start
tots_end
.To illustrate my case, let's say I'm a librarian and I got books people can borrow over a limited amount of time (15 days).
The same book can't be borrowed twice at the same time, hence I would like to prevent any link creation to a same book if there is an overlapping period.
How would I achieve such constraint ?
Beta Was this translation helpful? Give feedback.
All reactions