Search code examples
mysqldiagramcheck-constraints

How to create check constraint in mysql diagram view?


Lets say I have a table like this:

CREATE TABLE IF NOT EXISTS 
newbook_mast (book_id varchar(15) NOT NULL UNIQUE,          
book_name varchar(50)  ,           
isbn_no varchar(15)  NOT NULL UNIQUE  ,           
cate_id varchar(8)  ,             
aut_id varchar(8) ,             
pub_id varchar(8) ,            
dt_of_pub date ,             
pub_lang varchar(15) ,           
no_page decimal(5,0)            
book_price decimal(8,2) ,             
PRIMARY KEY (book_id)               
);

If I wanted to add a check on a column I would simply write :

CHECK(no_page>0) 

But instead of writing the code I am creating diagram models in the mysql workbench. I am unable to find how I can add a check like above by just using the diagram model?

Is it possible?


Solution

  • MySQL Workbench as of at least version 8.0.19 does not support CHECK constraints in navigator, table editor, or diagrams.

    This has been reported as a missing feature:

    https://bugs.mysql.com/bug.php?id=95143 No support for CHECK constraints in Workbench

    You should log into the bugs site and click the "Affects Me" button on that bug.