forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/find-return-type
- Loading branch information
Showing
6 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
Column, | ||
Entity, | ||
OneToMany, | ||
PrimaryGeneratedColumn, | ||
} from "../../../../src" | ||
import { Todo } from "./todo" | ||
|
||
@Entity({ name: "person" }) | ||
export class Person { | ||
@PrimaryGeneratedColumn("uuid") | ||
id: string | ||
|
||
@Column("varchar") | ||
name: string | ||
|
||
@OneToMany(() => Todo, (o) => o.owner) | ||
todos: Todo[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
Column, | ||
Entity, | ||
ManyToOne, | ||
PrimaryGeneratedColumn, | ||
} from "../../../../src" | ||
import { Person } from "./person" | ||
|
||
@Entity({ name: "todo" }) | ||
export class Todo { | ||
@PrimaryGeneratedColumn("uuid") | ||
id: string | ||
|
||
@Column("varchar") | ||
description: string | ||
|
||
@ManyToOne(() => Person, (o) => o.todos) | ||
owner: Person | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect } from "chai" | ||
import { DataSource } from "../../../src" | ||
import { | ||
closeTestingConnections, | ||
createTestingConnections, | ||
reloadTestingDatabases, | ||
} from "../../utils/test-utils" | ||
import { Person } from "./entity/person" | ||
import { Todo } from "./entity/todo" | ||
|
||
describe("github issues > #10040 TypeORM synchronize database even if it is up to date", () => { | ||
let dataSources: DataSource[] | ||
|
||
before(async () => { | ||
dataSources = await createTestingConnections({ | ||
entities: [Person, Todo], | ||
enabledDrivers: ["mysql"], | ||
}) | ||
}) | ||
|
||
beforeEach(() => reloadTestingDatabases(dataSources)) | ||
after(() => closeTestingConnections(dataSources)) | ||
|
||
it("should return an empty array for the upQueries after sync", async () => { | ||
await Promise.all( | ||
dataSources.map(async (dataSource) => { | ||
await dataSource.synchronize() | ||
const logs = await dataSource.driver.createSchemaBuilder().log() | ||
expect(logs.upQueries.length).to.be.eql(0) | ||
}), | ||
) | ||
}) | ||
}) |