I have a table named posts with some fields and I would like to restrict the field 'type' to accept only 3 strings 'video' 'photo' and 'slideshow'
how to do it?
I tried
alter property Post.type add constraint check
(post.type in ('video','photo','slideshow'));
but it is not working
how to add a constraint in orientdb like
alter table post add constraint check(type in ('video','photo','slideshow'));
You can do it by addind a REGEXP on the property :
CREATE CLASS Post Extends V
CREATE PROPERTY Post.type STRING
Alter PROPERTY Post.type REGEXP "video|photo|slideshow"
Hope it helps