neopg 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ModelChain.js CHANGED
@@ -247,7 +247,9 @@ class ModelChain {
247
247
 
248
248
  _buildOrder() {
249
249
  if (this._order.length === 0) return this.sql``
250
- return this.sql`ORDER BY ${this._order}`
250
+ if (this._order.length === 1) return this.sql`ORDER BY ${this._order}`
251
+ let _orderby = this._order.reduce((acc, curr) => this.sql`${acc}, ${curr}`)
252
+ return this.sql`ORDER BY ${_orderby}`
251
253
  }
252
254
 
253
255
  _buildJoins() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neopg",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "orm for postgres",
5
5
  "keywords": [
6
6
  "neopg",
package/test/test-db.js CHANGED
@@ -271,7 +271,7 @@ db.add(User)
271
271
 
272
272
  console.log(
273
273
  'test select *',
274
- await tx.model('User').select().find()
274
+ await tx.model('User').orderby('level', 'DESC').orderby('id', 'ASC').select().find()
275
275
  )
276
276
 
277
277
  console.log(