@@ -43,6 +43,45 @@ export const postgresColumnSchema = Type.Object({
43
43
} )
44
44
export type PostgresColumn = Static < typeof postgresColumnSchema >
45
45
46
+ export const postgresColumnCreateSchema = Type . Object ( {
47
+ table_id : Type . Integer ( ) ,
48
+ name : Type . String ( ) ,
49
+ type : Type . String ( ) ,
50
+ default_value : Type . Optional ( Type . Unknown ( ) ) ,
51
+ default_value_format : Type . Optional (
52
+ Type . Union ( [ Type . Literal ( 'expression' ) , Type . Literal ( 'literal' ) ] )
53
+ ) ,
54
+ is_identity : Type . Optional ( Type . Boolean ( ) ) ,
55
+ identity_generation : Type . Optional (
56
+ Type . Union ( [ Type . Literal ( 'BY DEFAULT' ) , Type . Literal ( 'ALWAYS' ) ] )
57
+ ) ,
58
+ is_nullable : Type . Optional ( Type . Boolean ( ) ) ,
59
+ is_primary_key : Type . Optional ( Type . Boolean ( ) ) ,
60
+ is_unique : Type . Optional ( Type . Boolean ( ) ) ,
61
+ comment : Type . Optional ( Type . String ( ) ) ,
62
+ check : Type . Optional ( Type . String ( ) ) ,
63
+ } )
64
+ export type PostgresColumnCreate = Static < typeof postgresColumnCreateSchema >
65
+
66
+ export const postgresColumnUpdateSchema = Type . Object ( {
67
+ name : Type . Optional ( Type . String ( ) ) ,
68
+ type : Type . Optional ( Type . String ( ) ) ,
69
+ drop_default : Type . Optional ( Type . Boolean ( ) ) ,
70
+ default_value : Type . Optional ( Type . Unknown ( ) ) ,
71
+ default_value_format : Type . Optional (
72
+ Type . Union ( [ Type . Literal ( 'expression' ) , Type . Literal ( 'literal' ) ] )
73
+ ) ,
74
+ is_identity : Type . Optional ( Type . Boolean ( ) ) ,
75
+ identity_generation : Type . Optional (
76
+ Type . Union ( [ Type . Literal ( 'BY DEFAULT' ) , Type . Literal ( 'ALWAYS' ) ] )
77
+ ) ,
78
+ is_nullable : Type . Optional ( Type . Boolean ( ) ) ,
79
+ is_unique : Type . Optional ( Type . Boolean ( ) ) ,
80
+ comment : Type . Optional ( Type . String ( ) ) ,
81
+ check : Type . Optional ( Type . Union ( [ Type . String ( ) , Type . Null ( ) ] ) ) ,
82
+ } )
83
+ export type PostgresColumnUpdate = Static < typeof postgresColumnUpdateSchema >
84
+
46
85
// TODO Rethink config.sql
47
86
export const postgresConfigSchema = Type . Object ( {
48
87
name : Type . Unknown ( ) ,
0 commit comments