docspell
docspell copied to clipboard
Add unique option to custom data
Hi, I have a custom field for which I would like to make sure it is/stays unique. Is it possible to add a corresponding option to the definition of a field, or am I the only one who needs something like this? Cheers Eresturo
It didn't occur to me as important :) But I can see that this would be helpful in some cases. I probably wouldn't try to enforce it at the db-level. Maybe the server doing a check when setting a value is an option.
Great idea! In addition to it, it would be useful to have a composite unique constraint. I've got invoices with an invoice number, but I can have the same invoice number from an other organisation.
The classic use-case here is the ASN field.
If the ASN is generated outside of docspell, its source already guarantees uniqueness. most of the time I'd think :). like these nice stamps that generate consecutive numbers.
These things get quickly very complex and they will be hard to understand after a while. I think I might add a uniqueness option for a field, but not in combination with other fields/metadata. For invoices, in theory you could have same invoice numbers from different companies. But in my eyes, this is a very rare reality and not a problem at all. If that occurs, you might see two or three documents in the results and one look will identify the one you want. If you know the company, just add a constraint for it. For me this is not a strong enough case for adding more things atm.