-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[x] 0.2.24
Steps to reproduce or a small repository showing the problem:
The following entity fails to synchronize because there is a single quote in the column's comment:
@Entity("session")
export class Session {
@PrimaryColumn({
name: "session_id",
type: "varchar",
length: 255,
comment: "That's the way the cookie crumbles"
})
id: string = "";
@Column({
name: "json",
type: "text"
})
json: string = "";
@Index()
@Column({
name: "expired_at",
type: "bigint",
transformer: { from: Number, to: Number }
})
expiredAt: number = Date.now();
}The error is:
QueryFailedError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'the way the cookie crumbles', `json` text NOT NULL, `expired_at` bigint NOT NULL' at line 1
at new QueryFailedError (D:\Programming\project\node_modules\typeorm\error\QueryFailedError.js:11:28)
at Query.<anonymous> (D:\Programming\project\node_modules\typeorm\driver\mysql\MysqlQueryRunner.js:170:45)
at Query.<anonymous> (D:\Programming\project\node_modules\mysql\lib\Connection.js:526:10)
at Query._callback (D:\Programming\project\node_modules\mysql\lib\Connection.js:488:16)
at Query.Sequence.end (D:\Programming\project\node_modules\mysql\lib\protocol\sequences\Sequence.js:83:24)
at Query.ErrorPacket (D:\Programming\project\node_modules\mysql\lib\protocol\sequences\Query.js:92:8)
at Protocol._parsePacket (D:\Programming\project\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (D:\Programming\project\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (D:\Programming\project\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (D:\Programming\project\node_modules\mysql\lib\protocol\Protocol.js:38:16) {
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'the way the cookie crumbles', `json` text NOT NULL, `expired_at` bigint NOT NULL' at line 1",
sqlState: '42000',
index: 0,
sql: "CREATE TABLE `session` (`session_id` varchar(255) NOT NULL COMMENT 'That's the way the cookie crumbles', `json` text NOT NULL, `expired_at` bigint NOT NULL, INDEX `IDX_bdf5fdcd0b49753475efec8397` (`expired_at`), PRIMARY KEY (`session_id`)) ENGINE=InnoDB",
query: "CREATE TABLE `session` (`session_id` varchar(255) NOT NULL COMMENT 'That's the way the cookie crumbles', `json` text NOT NULL, `expired_at` bigint NOT NULL, INDEX `IDX_bdf5fdcd0b49753475efec8397` (`expired_at`), PRIMARY KEY (`session_id`)) ENGINE=InnoDB",
parameters: []
}
Metadata
Metadata
Assignees
Labels
No labels