File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -1680,7 +1680,7 @@ export class MysqlQueryRunner extends BaseQueryRunner implements QueryRunner {
16801680 if ( column . isGenerated && column . generationStrategy === "increment" ) // don't use skipPrimary here since updates can update already exist primary without auto inc.
16811681 c += " AUTO_INCREMENT" ;
16821682 if ( column . comment )
1683- c += ` COMMENT '${ column . comment } '` ;
1683+ c += ` COMMENT '${ column . comment . replace ( "'" , "''" ) } '` ;
16841684 if ( column . default !== undefined && column . default !== null )
16851685 c += ` DEFAULT ${ column . default } ` ;
16861686 if ( column . onUpdate )
Original file line number Diff line number Diff line change 1+ import { Entity , PrimaryColumn } from "../../../../src" ;
2+
3+ @Entity ( )
4+ export class Session {
5+
6+ @PrimaryColumn ( {
7+ comment : "That's the way the cookie crumbles"
8+ } )
9+ cookie : string = "" ;
10+
11+ }
Original file line number Diff line number Diff line change 1+ import "reflect-metadata" ;
2+ import { createTestingConnections , closeTestingConnections } from "../../utils/test-utils" ;
3+ import { QueryFailedError , Connection } from "../../../src" ;
4+ import { Session } from "./entity/Session" ;
5+ import { expect } from "chai" ;
6+
7+ describe ( "github issues > #6066 Column comment string is not escaped during synchronization" , ( ) => {
8+
9+ let connections : Connection [ ] ;
10+ before ( async ( ) => connections = await createTestingConnections ( {
11+ entities : [ Session ] ,
12+ enabledDrivers : [ "mysql" , "mariadb" ] ,
13+ schemaCreate : false ,
14+ dropSchema : true ,
15+ } ) ) ;
16+ after ( ( ) => closeTestingConnections ( connections ) ) ;
17+
18+ it ( "should synchronize" , ( ) => Promise . all ( connections . map ( connection => {
19+ return expect ( connection . synchronize ( ) ) . to . not . be . rejectedWith ( QueryFailedError ) ;
20+ } ) ) ) ;
21+
22+ } ) ;
You can’t perform that action at this time.
0 commit comments