lngovn / sequelize-typescript-model-migration

Auto-generate migration script from sequelize-typescript model
MIT License
6 stars 6 forks source link

migration error with mariadb 'ILIKE' #3

Open ahmadpy888 opened 3 years ago

ahmadpy888 commented 3 years ago

node:98098) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: (conn=4097, no: 1064, SQLState: 42000) 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 'ILIKE '%20210901075730-user.js%' ORDER BYSequelizeMeta.nameDESC LIMIT 1' at line 1 sql: SELECTnameFROMSequelizeMetaASSequelizeMetaWHERESequelizeMeta.nameILIKE '%20210901075730-user.js%' ORDER BYSequelizeMeta.nameDESC LIMIT 1; - parameters:[]

my database.ts .... try { (async () => { await generateMigration(dbs, { outDir: path.join(__dirname, "../migrations"), snapshotDir: path.join(__dirname, "../migrations/snapshots"), migrationName: "20210901075730-user.js", }); })(); } catch (error) { console.log(error); }

my package.json ... "dependencies": { "@types/uuid": "^8.3.1", "bcrypt": "^5.0.1", "cors": "^2.8.5", "date-fns": "^2.23.0", "dotenv": "^10.0.0", "express": "^4.17.1", "express-jwt": "^6.1.0", "jsonwebtoken": "^8.5.1", "mariadb": "^2.5.4", "mysql2": "^2.3.0", "reflect-metadata": "^0.1.13", "sequelize": "6.6.2", "sequelize-typescript": "^2.1.0", "umzug": "^2.3.0", "uuid": "^8.3.2" }, "devDependencies": { "@types/bcrypt": "^5.0.0", "@types/bluebird": "^3.5.36", "@types/cors": "^2.8.12", "@types/express": "^4.17.13", "@types/express-jwt": "^6.0.2", "@types/jsonwebtoken": "^8.5.5", "@types/node": "^16.7.8", "@types/validator": "^13.6.3", "sequelize-cli": "^6.2.0", "sequelize-typescript-migration": "^0.0.1-beta.3", "sequelize-typescript-model-migration": "^1.0.13", "sequelize-typescript-mysql-migration": "^1.0.0", "ts-node": "^10.2.1", "typescript": "^4.4.2" }

yelusaku commented 2 years ago

It seems keyword 'ILIKE' is not supported by mysql.

edmundito commented 2 years ago

I got the same for a SQLite db.

Abobos commented 2 years ago

I got the same for a MYSQL DB. how can we fix this? @lngovn, @yelusaku, @edmundito.

Dracks commented 1 year ago

I think this should fix the problem: https://github.com/lngovn/sequelize-typescript-model-migration/pull/5