Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 8edc634

Browse files
committed
added new case in change-column test (typeorm#5072)
1 parent 1b9c5ab commit 8edc634

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/functional/schema-builder/change-column.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ describe("schema builder > change column", () => {
9797
postVersionColumn.type = "varchar";
9898
})));
9999

100+
it("should correctly change column default value", () => Promise.all(connections.map(async connection => {
101+
102+
const postMetadata = connection.getMetadata(Post);
103+
const nameColumn = postMetadata.findColumnWithPropertyName("name")!;
104+
105+
nameColumn.default = "My awesome post";
106+
nameColumn.build(connection);
107+
108+
await connection.synchronize(false);
109+
110+
const queryRunner = connection.createQueryRunner();
111+
const postTable = await queryRunner.getTable("post");
112+
await queryRunner.release();
113+
114+
postTable!.findColumnByName("name")!.default.should.be.equal("'My awesome post'");
115+
116+
})));
117+
100118
it("should correctly make column primary and generated", () => Promise.all(connections.map(async connection => {
101119
// CockroachDB does not allow changing PK
102120
if (connection.driver instanceof CockroachDriver)

0 commit comments

Comments
 (0)