Skip to content

Commit

Permalink
Update sequelize v5 (#40)
Browse files Browse the repository at this point in the history
* Update sequelize version

* refactor(Update Sequelize V5): Remove security warning by upgrading to v5

BREAKING CHANGE: Underscore is removed from config, findById -> findByPk
  • Loading branch information
joshuaalpuerto authored Apr 15, 2019
1 parent b9bb5e8 commit 951a8a9
Show file tree
Hide file tree
Showing 4 changed files with 12,436 additions and 15 deletions.
14 changes: 1 addition & 13 deletions config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,16 @@ require('dotenv').config({ path: dotEnvPath })
module.exports = {
development: {
'url': process.env.DATABASE_URL,
'dialect': 'postgres',
'define': {
'underscored': true
}
'dialect': 'postgres'
},
test: {
'url': process.env.DATABASE_URL_TEST,
'dialect': 'postgres',
'define': {
'underscored': true
},
logging: false // remove logs
},
staging: {
'url': process.env.DATABASE_URL_STAGING,
'dialect': 'postgres',
'define': {
'underscored': false
},
'ssl': true,
'dialectOptions': {
'ssl': {
Expand All @@ -38,9 +29,6 @@ module.exports = {
production: {
'url': process.env.DATABASE_URL_PRODUCTION,
'dialect': 'postgres',
'define': {
'underscored': false
},
'ssl': true,
'dialectOptions': {
'ssl': {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"pg": "7.8.1",
"pm2": "3.3.1",
"ramda": "0.26.1",
"sequelize": "4.43.0",
"sequelize": "5.5.0",
"swagger-jsdoc": "3.2.7",
"tcomb": "3.2.29",
"winston": "3.2.1"
Expand Down
2 changes: 1 addition & 1 deletion src/infra/repositories/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = ({ model }) => {
.catch((error) => { throw new Error(error) })

const findById = (...args) =>
model.findById(...args)
model.findByPk(...args)
.then(({ dataValues }) => toEntity(dataValues))
.catch((error) => { throw new Error(error) })

Expand Down
Loading

0 comments on commit 951a8a9

Please sign in to comment.