File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,12 @@ export const postgresColumnUpdateSchema = Type.Object({
7777 is_nullable : Type . Optional ( Type . Boolean ( ) ) ,
7878 is_unique : Type . Optional ( Type . Boolean ( ) ) ,
7979 comment : Type . Optional ( Type . String ( ) ) ,
80- check : Type . Optional ( Type . Union ( [ Type . String ( ) , Type . Null ( ) ] ) ) ,
80+ check : Type . Optional (
81+ Type . Union (
82+ // Type.Null() must go first: https://github.com/sinclairzx81/typebox/issues/546
83+ [ Type . Null ( ) , Type . String ( ) ]
84+ )
85+ ) ,
8186} )
8287export type PostgresColumnUpdate = Static < typeof postgresColumnUpdateSchema >
8388
Original file line number Diff line number Diff line change @@ -933,3 +933,17 @@ test('column with multiple checks', async () => {
933933
934934 await pgMeta . query ( `drop table t` )
935935} )
936+
937+ test ( 'dropping column checks' , async ( ) => {
938+ await pgMeta . query ( `create table public.t(c int8 check (c != 0))` )
939+
940+ let res = await pgMeta . columns . retrieve ( {
941+ schema : 'public' ,
942+ table : 't' ,
943+ name : 'c' ,
944+ } )
945+ res = await pgMeta . columns . update ( res . data ! . id , { check : null } )
946+ expect ( res ?. data ?. check ) . toMatchInlineSnapshot ( `null` )
947+
948+ await pgMeta . query ( `drop table t` )
949+ } )
You can’t perform that action at this time.
0 commit comments