File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 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 {
8585 default_value_format = 'literal' ,
8686 is_identity = false ,
8787 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,
8990 is_primary_key = false ,
9091 is_unique = false ,
9192 comment,
@@ -119,7 +120,10 @@ export default class PostgresMetaColumns {
119120 defaultValueClause = `DEFAULT ${ literal ( default_value ) } `
120121 }
121122 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+ }
123127 const isPrimaryKeyClause = is_primary_key ? 'PRIMARY KEY' : ''
124128 const isUniqueClause = is_unique ? 'UNIQUE' : ''
125129 const checkSql = check === undefined ? '' : `CHECK (${ check } )`
You can’t perform that action at this time.
0 commit comments