File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ COMMIT;`
225
225
is_nullable ?: boolean
226
226
is_unique ?: boolean
227
227
comment ?: string
228
- check ?: string
228
+ check ?: string | null
229
229
}
230
230
) : Promise < PostgresMetaResult < PostgresColumn > > {
231
231
const { data : old , error } = await this . retrieve ( { id } )
@@ -353,9 +353,12 @@ BEGIN
353
353
) } DROP CONSTRAINT %s', v_conname);
354
354
END IF;
355
355
356
+ ${
357
+ check !== null
358
+ ? `
356
359
ALTER TABLE ${ ident ( old ! . schema ) } .${ ident ( old ! . table ) } ADD CONSTRAINT ${ ident (
357
- `${ old ! . table } _${ old ! . name } _check`
358
- ) } CHECK (${ check } );
360
+ `${ old ! . table } _${ old ! . name } _check`
361
+ ) } CHECK (${ check } );
359
362
360
363
SELECT conkey into v_conkey FROM pg_constraint WHERE conname = ${ literal (
361
364
`${ old ! . table } _${ old ! . name } _check`
@@ -366,6 +369,9 @@ BEGIN
366
369
ASSERT v_conkey[1] = ${ literal (
367
370
old ! . ordinal_position
368
371
) } , 'error creating column constraint: check condition cannot refer to other columns';
372
+ `
373
+ : ''
374
+ }
369
375
END
370
376
$$;
371
377
`
You can’t perform that action at this time.
0 commit comments