This repository was archived by the owner on Apr 4, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Column , Entity , PrimaryGeneratedColumn } from "../../../../src" ;
2
+
3
+ enum StandardSetType {
4
+ AcademicStandard = "AcademicStandard" ,
5
+ FoundationalKnowledge = "FoundationalKnowledge" ,
6
+ AchievementDescriptor = "AchievementDescriptor" ,
7
+ }
8
+
9
+ @Entity ( )
10
+ export class TestEntity {
11
+ @PrimaryGeneratedColumn ( )
12
+ ud : number
13
+
14
+ @Column ( "enum" , { enum : StandardSetType , name : "type" } )
15
+ type : StandardSetType ;
16
+ }
Original file line number Diff line number Diff line change
1
+ import "reflect-metadata" ;
2
+ import { Connection } from "../../../src" ;
3
+ import { closeTestingConnections , createTestingConnections } from "../../utils/test-utils" ;
4
+ import { TestEntity } from "./entity/Test" ;
5
+
6
+ describe ( "github issues > #7541 Column of type `enum` throws missing properties error" , ( ) => {
7
+ let connections : Connection [ ] ;
8
+ before ( async ( ) => connections = await createTestingConnections ( {
9
+ enabledDrivers : [ "postgres" ] ,
10
+ schemaCreate : false ,
11
+ dropSchema : true ,
12
+ entities : [ TestEntity ] ,
13
+ } ) ) ;
14
+ after ( ( ) => closeTestingConnections ( connections ) ) ;
15
+
16
+ it ( "should recognize model changes" , ( ) => Promise . all ( connections . map ( async connection => {
17
+ const sqlInMemory = await connection . driver . createSchemaBuilder ( ) . log ( ) ;
18
+ sqlInMemory . upQueries . length . should . be . greaterThan ( 0 ) ;
19
+ sqlInMemory . downQueries . length . should . be . greaterThan ( 0 ) ;
20
+ } ) ) ) ;
21
+
22
+ it ( "should not generate queries when no model changes" , ( ) => Promise . all ( connections . map ( async connection => {
23
+ await connection . driver . createSchemaBuilder ( ) . build ( ) ;
24
+ const sqlInMemory = await connection . driver . createSchemaBuilder ( ) . log ( ) ;
25
+ sqlInMemory . upQueries . length . should . be . equal ( 0 ) ;
26
+ sqlInMemory . downQueries . length . should . be . equal ( 0 ) ;
27
+ } ) ) ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments