qrite sql query using sequelize code example
Example 1: sequelize query result
sequelize.query("UPDATE users SET y = 42 WHERE x = 12").spread(function(results,
metadata) {
})
sequelize.query("SELECT * FROM `users`", { type: sequelize.QueryTypes.SELECT})
.then(function(users) {
})
Example 2: sequelize
$ npm install --save sequelize # This will install v5
$ npm install --save-dev sequelize-cli
# And one of the following:
$ npm install --save pg pg-hstore # Postgres
$ npm install --save mysql2
$ npm install --save mariadb
$ npm install --save sqlite3
$ npm install --save tedious # Microsoft SQL Server
$ npm install mysql2 -g
$ npm install -g sequelize-auto-v2
sequelize-auto -o "./models" -d schema -h localhost -u user -p 3306 -x password -e dialect
Exemple:
sequelize-auto -o "./models" -d nomeDoShema -h localhost -u usuarioDaConexao -p 3306 -x senhaDaConexao -e mysql