I am unable to apply a check constraint with liquibase.
Via direct sql I can do this
$psql -c "CREATE TABLE a ( colors text CHECK (colors IN (‘red’, ‘yellow’, ‘blue’))); "
CREATE TABLE
$psql -c ‘\d+ a;’
Table “gro.a”
Column | Type | Modifiers | Storage | Stats target | Description
--------±-----±----------±---------±-------------±------------
colors | text | | extended | |
Check constraints:
“a_colors_check” CHECK (colors = ANY (ARRAY[‘red’::text, ‘yellow’::text, ‘blue’::text]))
Has OIDs: no
The check constraint is correctly applied via SQL.
How do I do the above in my xml?
I tried the following
and
and
However that check constraint does not get registered. What am I missing?
$ psql -c ‘\d+ x;’
Table “public.x”
Column | Type | Modifiers | Storage | Stats target | Description
--------±-----±----------±---------±-------------±------------
colors | text | | extended | |
Has OIDs: no
$ psql -c ‘\d+ y;’
Table “public.y”
Column | Type | Modifiers | Storage | Stats target | Description
--------±-----±----------±---------±-------------±------------
colors | text | | extended | |
Has OIDs: no
$ psql -c ‘\d+ z;’
Table “public.z”
Column | Type | Modifiers | Storage | Stats target | Description
--------±-----±----------±---------±-------------±------------
colors | text | | extended | |
Has OIDs: no