0

I have field Gender in my table. It should contain any one of 'M,F,O' values only. How to make it possible?

I'm using sequalize ORM in node.js for postgres, how to do it in sequalize?

1

1 Answer 1

1

You can add a check constraint:

alter table t add constraint chk_t_gender
    check ( gender in ('M', 'F', 'O') );

Note: This check constraint allows NULL values. You can define the column as NOT NULL to disallow those.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.