[schema] Add file_category relation to binary data objects
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 11 Oct 2017 15:11:03 +0200
changeset 2745 82e332e6c5b8
parent 2744 32150c18b188
child 2746 0f01adf6f65e
[schema] Add file_category relation to binary data objects This relation will be used in later csets to link the file to a high-level file format, that will be used to control low-level mime type and format id fields. Related to extranet #36331831
cubicweb_seda/migration/0.11.0_Any.py
cubicweb_seda/schema/__init__.py
--- a/cubicweb_seda/migration/0.11.0_Any.py	Wed Oct 11 15:08:06 2017 +0200
+++ b/cubicweb_seda/migration/0.11.0_Any.py	Wed Oct 11 15:11:03 2017 +0200
@@ -44,3 +44,4 @@
 
 sync_schema_props_perms('user_cardinality')
 
+add_relation_type('file_category')
--- a/cubicweb_seda/schema/__init__.py	Wed Oct 11 15:08:06 2017 +0200
+++ b/cubicweb_seda/schema/__init__.py	Wed Oct 11 15:11:03 2017 +0200
@@ -85,6 +85,15 @@
     inlined = True
 
 
+class file_category(RelationDefinition):
+    subject = 'SEDABinaryDataObject'
+    object = 'Concept'
+    cardinality = '**'
+    constraints = [
+        RQLConstraint('O in_scheme CS, CS scheme_relation_type CR, CR name "file_category"'),
+    ]
+
+
 class container(RelationType):
     inlined = False