Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: escape column comment in mysql driver (#6056)
* Fixed bug with unescaped comment string in MySQL driver. * Added tests. * Fixed linting issue.
- Loading branch information
Showing
3 changed files
with
34 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,11 @@ | ||
import {Entity, PrimaryColumn} from "../../../../src"; | ||
|
||
@Entity() | ||
export class Session { | ||
|
||
@PrimaryColumn({ | ||
comment: "That's the way the cookie crumbles" | ||
}) | ||
cookie: 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,22 @@ | ||
import "reflect-metadata"; | ||
import {createTestingConnections, closeTestingConnections} from "../../utils/test-utils"; | ||
import {QueryFailedError, Connection} from "../../../src"; | ||
import {Session} from "./entity/Session"; | ||
import {expect} from "chai"; | ||
|
||
describe("github issues > #6066 Column comment string is not escaped during synchronization", () => { | ||
|
||
let connections: Connection[]; | ||
before(async () => connections = await createTestingConnections({ | ||
entities: [Session], | ||
enabledDrivers: ["mysql", "mariadb"], | ||
schemaCreate: false, | ||
dropSchema: true, | ||
})); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should synchronize", () => Promise.all(connections.map(connection => { | ||
return expect(connection.synchronize()).to.not.be.rejectedWith(QueryFailedError); | ||
}))); | ||
|
||
}); |