Open braianj opened 4 years ago
Hi guys, when performing a search with MySql as database it return this error
(node:28) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'sequelize' of 'model.QueryInterface' as it is undefined.
The best solution we found is inside helper file change
`const getDialectFromModel = model => { const { sequelize } = model.QueryInterface;
return sequelize.options.dialect; };`
to this
const getDialectFromModel = model => { return model.sequelize.options.dialect; };
package.json
{"dependencies": { "@fortawesome/fontawesome-free": "^5.14.0", "bcrypt": "^5.0.0", "body-parser": "^1.19.0", "bootstrap": "^4.5.0", "connect-flash": "^0.1.1", "cookie-parser": "^1.4.5", "debug": "~2.6.9", "dotenv": "^8.2.0", "ejs": "~2.6.1", "express": "~4.16.1", "express-session": "^1.17.1", "express-validator": "^6.6.0", "googleapis": "^39.2.0", "http-errors": "~1.6.3", "humanize-duration": "^3.23.1", "moment": "^2.27.0", "morgan": "~1.9.1", "mysql2": "^2.1.0", "node-fetch": "^2.6.0", "numeral": "^2.0.6", "passport": "^0.4.1", "passport-facebook": "^3.0.0", "passport-google-oauth": "^2.0.0", "passport-local": "^1.0.0", "passport-remember-me": "0.0.1", "select2": "^4.0.13", "sequelize": "^6.3.1", "sequelize-datatables": "^3.0.0", "serve-favicon": "^2.5.0", "simplebar": "^5.2.1", "twig": "^1.15.1", "uuid": "^8.3.0" }, "devDependencies": { "@types/express": "^4.17.7", "concurrently": "^5.2.0", "node-sass": "^4.14.1", "sequelize-cli": "^6.2.0" }}
What do you think is the best way to make it work?
I think you should ask for pull request, because your solution works. I've tried using psql
@alwint3r
Hi guys, when performing a search with MySql as database it return this error
(node:28) UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property 'sequelize' of 'model.QueryInterface' as it is undefined.
The best solution we found is inside helper file change
`const getDialectFromModel = model => { const { sequelize } = model.QueryInterface;
return sequelize.options.dialect; };`
to this
const getDialectFromModel = model => { return model.sequelize.options.dialect; };
package.json
{"dependencies": { "@fortawesome/fontawesome-free": "^5.14.0", "bcrypt": "^5.0.0", "body-parser": "^1.19.0", "bootstrap": "^4.5.0", "connect-flash": "^0.1.1", "cookie-parser": "^1.4.5", "debug": "~2.6.9", "dotenv": "^8.2.0", "ejs": "~2.6.1", "express": "~4.16.1", "express-session": "^1.17.1", "express-validator": "^6.6.0", "googleapis": "^39.2.0", "http-errors": "~1.6.3", "humanize-duration": "^3.23.1", "moment": "^2.27.0", "morgan": "~1.9.1", "mysql2": "^2.1.0", "node-fetch": "^2.6.0", "numeral": "^2.0.6", "passport": "^0.4.1", "passport-facebook": "^3.0.0", "passport-google-oauth": "^2.0.0", "passport-local": "^1.0.0", "passport-remember-me": "0.0.1", "select2": "^4.0.13", "sequelize": "^6.3.1", "sequelize-datatables": "^3.0.0", "serve-favicon": "^2.5.0", "simplebar": "^5.2.1", "twig": "^1.15.1", "uuid": "^8.3.0" }, "devDependencies": { "@types/express": "^4.17.7", "concurrently": "^5.2.0", "node-sass": "^4.14.1", "sequelize-cli": "^6.2.0" }}
What do you think is the best way to make it work?