-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: broken database option when using replication, changes introduce…
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Entity, Column, PrimaryGeneratedColumn } from "../../../../src"; | ||
|
||
@Entity() | ||
export class User { | ||
@PrimaryGeneratedColumn() | ||
id: number; | ||
|
||
@Column() | ||
name: string; | ||
} |
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 { getConnectionManager } from "../../../src"; | ||
import { Connection } from "../../../src/connection/Connection"; | ||
import { closeTestingConnections } from "../../utils/test-utils"; | ||
import { User } from "./entity/User"; | ||
|
||
describe("github issues > #4753 MySQL Replication Config broken", () => { | ||
let connections: Connection[] = []; | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should connect without error when using replication", async () => { | ||
const connection = getConnectionManager().create({ | ||
type: "mysql", | ||
replication: { | ||
master: { | ||
username: "test", | ||
password: "test", | ||
database: "test" | ||
}, | ||
slaves: [ | ||
{ | ||
username: "test", | ||
password: "test", | ||
database: "test" | ||
} | ||
] | ||
}, | ||
entities: [User] | ||
}); | ||
connections.push(connection); | ||
await connection.connect(); | ||
connection.isConnected.should.be.true; | ||
}); | ||
}); |