File tree 2 files changed +20
-1
lines changed
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({
77
77
is_nullable : Type . Optional ( Type . Boolean ( ) ) ,
78
78
is_unique : Type . Optional ( Type . Boolean ( ) ) ,
79
79
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
+ ) ,
81
86
} )
82
87
export type PostgresColumnUpdate = Static < typeof postgresColumnUpdateSchema >
83
88
Original file line number Diff line number Diff line change @@ -933,3 +933,17 @@ test('column with multiple checks', async () => {
933
933
934
934
await pgMeta . query ( `drop table t` )
935
935
} )
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