I have a ENUM column and I am using liquibase addCheckConstraint to allow only ENUM values. However, addCheckConstraint doesnt work and allows any value. My yaml changelog looks as follows:
- changeSet:
id: 1565352995028-1
author: Zafrullah Syed
changes:
- createTable:
columns:
- column:
constraints:
primaryKey: true
name: ID
type: NUMBER(19, 0)
- column:
name: STATUS_ENUM
type: VARCHAR2(10 CHAR)
tableName: BOOKING
- addCheckConstraint:
constraintBody: STATUS_ENUM IN ('ERROR', 'CONFIRMED', 'QUEUED', 'REJECTED')
constraintName: enumcheck
tableName: SOME_TABLE
I am Using Oracle db.
If I try to run a sql query, then constraint works well:
ALTER TABLE SOME_TABLE
ADD CONSTRAINT enumcheck CHECK (status_enum IN ('ERROR', 'CONFIRMED', 'QUEUED', 'REJECTED'));
I tried to add another enableCheckConstraint to enable the existing check constraint but nothing seems to work.