[issue2551113] Consider adding unique=True|False for all hyperdb classes

John Rouillard <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
New submission from John Rouillard:

In https://sourceforge.net/p/roundup/mailman/message/37225443/ Nagy 
Gabor asked:

   Is it possible to tell Roundup to enforce the uniqueness of more
   than one property of a class?

Implement this adding a "unique=BOOLEAN" argument to __init__ of
the _Type class in roundup/hyperdb.py.

In rdbms backends it should add a unique constraint to the column.
In non-rdbms (anydb or other) it will need to execute code to
force constraint to be unique.

Does this make sense for all types?

  String (original use case) - yes, "foreign key" to another
     database somewhere, unique alternate name...

  Date - maybe, how useful is a unique date? Checking that a
     date+interval doesn't overlap any other date+interval is
     more useful (e.g. 1 patient for the 2021-10-14 09:00-09:15
     timeperiod). Could be useful is only a date (no time) is used.

  Link(_Pointer) - maybe, enforce unique relation (e.g. a chassis
     uses only one inventory number, a second chassis can't
     claim the same part). Allow only one issue in a particular
     state. E.G. Only one issue/workorder can be in the paint shop
     "state" at a time. 

  MultiLink(_Pointer)- maybe, don't have a use case.

  Number - yes, unique order if you want to include real values.

  Integer - yes, require unique order value for items

  Password - no, even the same password will have different salts
     so every duplicate password will hash as a different value.

  Interval - no, I think this is useful only with a start date
     (see discussion on Date above).

  Boolean - no, only two values so how useful is this

  Computed (experimental property not in trunk a this time) - no,
     points to a function

Currently this can be implemented using an auditor. See the mailing
list discussion for details.

----------
components: Database, Test
keywords: GSOC
messages: 7083
nosy: rouilj
priority: normal
severity: normal
status: new
title: Consider adding unique=True|False for all hyperdb classes
type: rfe

_________________________________________________
Roundup tracker <[email protected]>
<https://issues.roundup-tracker.org/issue2551113>
_________________________________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.