File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,8 @@ export default class PostgresMetaColumns {
85
85
default_value_format = 'literal' ,
86
86
is_identity = false ,
87
87
identity_generation = 'BY DEFAULT' ,
88
- is_nullable = true ,
88
+ // Can't pick a value as default since regular columns are nullable by default but PK columns aren't
89
+ is_nullable,
89
90
is_primary_key = false ,
90
91
is_unique = false ,
91
92
comment,
@@ -119,7 +120,10 @@ export default class PostgresMetaColumns {
119
120
defaultValueClause = `DEFAULT ${ literal ( default_value ) } `
120
121
}
121
122
const isIdentityClause = is_identity ? `GENERATED ${ identity_generation } AS IDENTITY` : ''
122
- const isNullableClause = is_nullable ? 'NULL' : 'NOT NULL'
123
+ let isNullableClause = ''
124
+ if ( is_nullable !== undefined ) {
125
+ isNullableClause = is_nullable ? 'NULL' : 'NOT NULL'
126
+ }
123
127
const isPrimaryKeyClause = is_primary_key ? 'PRIMARY KEY' : ''
124
128
const isUniqueClause = is_unique ? 'UNIQUE' : ''
125
129
const checkSql = check === undefined ? '' : `CHECK (${ check } )`
You can’t perform that action at this time.
0 commit comments