This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
test/functional/schema-builder Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,24 @@ describe("schema builder > change column", () => {
97
97
postVersionColumn . type = "varchar" ;
98
98
} ) ) ) ;
99
99
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
+
100
118
it ( "should correctly make column primary and generated" , ( ) => Promise . all ( connections . map ( async connection => {
101
119
// CockroachDB does not allow changing PK
102
120
if ( connection . driver instanceof CockroachDriver )
You can’t perform that action at this time.
0 commit comments