File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ COMMIT;`
225225 is_nullable ?: boolean
226226 is_unique ?: boolean
227227 comment ?: string
228- check ?: string
228+ check ?: string | null
229229 }
230230 ) : Promise < PostgresMetaResult < PostgresColumn > > {
231231 const { data : old , error } = await this . retrieve ( { id } )
@@ -353,9 +353,12 @@ BEGIN
353353 ) } DROP CONSTRAINT %s', v_conname);
354354 END IF;
355355
356+ ${
357+ check !== null
358+ ? `
356359 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 } );
359362
360363 SELECT conkey into v_conkey FROM pg_constraint WHERE conname = ${ literal (
361364 `${ old ! . table } _${ old ! . name } _check`
@@ -366,6 +369,9 @@ BEGIN
366369 ASSERT v_conkey[1] = ${ literal (
367370 old ! . ordinal_position
368371 ) } , 'error creating column constraint: check condition cannot refer to other columns';
372+ `
373+ : ''
374+ }
369375END
370376$$;
371377`
You can’t perform that action at this time.
0 commit comments