Welcome! Please see the About page for a little more info on how this works.

+1 vote
in On-Prem by

I have a tuple constraint as follows:

#:db{:id 182,
 :ident :ps2st/product-set+style-tier,
 :valueType :db.type/tuple,
 :cardinality :db.cardinality/one,
 :unique :db.unique/identity,
 :tupleAttrs [:ps2st/product-set :ps2st/style-tier]}

This constraint is overly restrictive. I read somewhere that tupleAttrs can not be altered, so I'd like to remove the constraint instead and then create a new one with more tuple attrs.

How can I delete a constraint?

3 Answers

+1 vote
selected by
Best answer

Hi, you just need to execute retract attribute value:

(:db/retract :ps2st/product-set+style-tier :unique :db.unique/identity)
0 votes

I should also mention that I tried the following:

@(d/transact c [[:db/retractEntity :ps2st/product-set+style-tier]])

But I'm not sure what this error means:

Execution error (Exceptions$IllegalArgumentExceptionInfo) at datomic.error/deserialize-exception (error.clj:146).
:db.error/datom-cannot-be-altered Boot datoms cannot be altered: [:db.part/db :db.install/attribute :ps2st/product-set+style-tier 13194139571760 false]

What if you `[:db/retract :ps2st/product-set+style-tier :db/unique :db.unique/identity]` ?
It should keep the tuple and just drop the uniqueness
Thanks, Enzzo.   That worked exactly as expected and resolved my problem.  

I'm marking this "answer" as "best" b/c your comment is here.  If you want to put your comment in a separate answer, I can mark that one instead?
0 votes

Hi. Just adfitional info, you got error on an aytemt to retract the attribute because the datomin does not allow to remove attributes from db.

Thanks for the info!
Welcome to the Datomic Knowledgebase, where you can make features requests, ask questions and receive answers from other members of the community.