fix(sql-tools): null default (#20796)

This commit is contained in:
Jason Rasmussen
2025-08-08 15:44:39 -04:00
committed by GitHub
parent 538d5c81ea
commit 2ce4f8dd3b
4 changed files with 34 additions and 3 deletions

View File

@@ -116,6 +116,20 @@ describe(transformColumns.name, () => {
}),
).toEqual([`ALTER TABLE "table1" ALTER COLUMN "column1" SET DEFAULT uuid_generate_v4();`]);
});
it('should update the default value to NULL', () => {
expect(
transformColumns(ctx, {
type: 'ColumnAlter',
tableName: 'table1',
columnName: 'column1',
changes: {
default: 'NULL',
},
reason: 'unknown',
}),
).toEqual([`ALTER TABLE "table1" ALTER COLUMN "column1" SET DEFAULT NULL;`]);
});
});
describe('ColumnDrop', () => {