-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
Using this repo typeorm.zip, run the follow to first setup the database
npm install
npm run mr
Here's the enum i'm setting:
enum test {
TEST1 = 'testing (brackets)',
TEST2 = 'testing (brackers too)',
}Expected behavior
If i run npm run mg test (command to generate migration scripts), i should not see new migration scripts generated becos i literally did not change anything.
Actual behavior
A new migration script is generated:
import {MigrationInterface, QueryRunner} from "typeorm";
export class test1586827112542 implements MigrationInterface {
name = 'test1586827112542'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query("ALTER TABLE `user` CHANGE `enumTest` `enumTest` enum ('testing (brackets)', 'testing (brackers too)') NOT NULL", undefined);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query("ALTER TABLE `user` CHANGE `enumTest` `enumTest` enum ('testing (bracket') NOT NULL", undefined);
}
}You can see that in the down script, the first enum value is being cut off. I suspect this might be a parsing bug from reading the existing table schema.
This behavoir did not occur if my enum does not have parentheses