From e6066769cac92e0d35a3e8c16b3cea3f9578a786 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Fri, 13 Jul 2018 15:40:27 -0700 Subject: [PATCH] Pre: Differentiate bad attribute retractions from unrecognized retractions. --- db/src/metadata.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/db/src/metadata.rs b/db/src/metadata.rs index 2e9a66c7..6e5768d0 100644 --- a/db/src/metadata.rs +++ b/db/src/metadata.rs @@ -133,6 +133,7 @@ pub fn update_attribute_map_from_entid_triples(attribute_map: &mut Attribu }, } }, + entids::DB_UNIQUE => { match *value { TypedValue::Ref(u) => { @@ -151,9 +152,18 @@ pub fn update_attribute_map_from_entid_triples(attribute_map: &mut Attribu _ => bail!(DbErrorKind::BadSchemaAssertion(format!("Expected [:db/retract _ :db/unique :db.unique/_] but got [:db/retract {} :db/unique {:?}]", entid, value))) } }, - _ => { + + entids::DB_VALUE_TYPE | + entids::DB_CARDINALITY | + entids::DB_INDEX | + entids::DB_FULLTEXT | + entids::DB_NO_HISTORY => { bail!(DbErrorKind::BadSchemaAssertion(format!("Retracting attribute {} for entity {} not permitted.", attr, entid))); }, + + _ => { + bail!(DbErrorKind::BadSchemaAssertion(format!("Do not recognize attribute {} for entid {}", attr, entid))) + } } }