Skip to content

Commit 5914c75

Browse files
authored
Release/1.6.10-mod (#5)
Release/1.6.10-mod
2 parents 9c672e2 + 0a1037a commit 5914c75

29 files changed

+498
-96
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ addons:
3535
postgresql: '9.5'
3636

3737
services:
38-
- mysql
38+
- mysql

doc/.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55

66
themeConfig: {
77
repo: 'vincit/objection.js',
8-
repoLabel: 'Github',
8+
repoLabel: 'GitHub',
99

1010
algolia: {
1111
apiKey: '8b9b4ac9f68d11c702e8102479760861',

doc/api/objection/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,17 @@ For older nodes:
297297
const Knex = require('knex');
298298
const knexSnakeCaseMappers = require('objection').knexSnakeCaseMappers;
299299

300-
const knex = Knex(Object.assign({
300+
const knex = Knex({
301301
client: 'postgres',
302302

303303
connection: {
304304
host: '127.0.0.1',
305305
user: 'objection',
306306
database: 'objection_test'
307-
}
308-
}, knexSnakeCaseMappers()));
307+
},
308+
309+
...knexSnakeCaseMappers()
310+
});
309311
```
310312

311313
## knexIdentifierMapping
@@ -381,19 +383,21 @@ For older nodes:
381383
const Knex = require('knex');
382384
const knexIdentifierMapping = require('objection').knexIdentifierMapping;
383385

384-
const knex = Knex(Object.assign({
386+
const knex = Knex({
385387
client: 'postgres',
386388

387389
connection: {
388390
host: '127.0.0.1',
389391
user: 'objection',
390392
database: 'objection_test'
391-
}
392-
}, knexIdentifierMapping({
393-
MyId: 'id',
394-
MyProp: 'prop',
395-
MyAnotherProp: 'anotherProp'
396-
})));
393+
},
394+
395+
...knexIdentifierMapping({
396+
MyId: 'id',
397+
MyProp: 'prop',
398+
MyAnotherProp: 'anotherProp'
399+
})
400+
});
397401
```
398402

399403
## ValidationError

doc/api/query-builder/find-methods.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ Type|Description
737737

738738
See [knex documentation](http://knexjs.org/#Builder-count)
739739

740+
Also see the [resultSize](/api/query-builder/other-methods.md#resultsize) method for a cleaner way to just get the number of rows a query would create.
741+
740742
##### Return value
741743

742744
Type|Description

doc/api/query-builder/other-methods.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,13 +947,15 @@ Type|Description
947947
const promise = queryBuilder.resultSize();
948948
```
949949

950-
Returns the amount of rows the current query would produce without [limit](/api/query-builder/find-methods.html#limit) and [offset](/api/query-builder/find-methods.html#offset) applied. Note that this executes a query (not the one we are building) and returns a Promise.
950+
Returns the amount of rows the current query would produce without [limit](/api/query-builder/find-methods.html#limit) and [offset](/api/query-builder/find-methods.html#offset) applied. Note that this executes a copy of the query and returns a Promise.
951+
952+
This method is often more convenient than `count` which returns an array of objects instead a single number.
951953

952954
##### Return value
953955

954956
Type|Description
955957
----|-----------------------------
956-
`Promise`|Promise the will be resolved with the result size.
958+
`Promise<number>`|Promise the will be resolved with the result size.
957959

958960
##### Examples
959961

doc/changelog/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.6.10
4+
5+
* Fixes [#1455](https://github.com/Vincit/objection.js/issues/1455)
6+
37
## 1.6.9
48

59
* Revert fix for [#1089](https://github.com/Vincit/objection.js/issues/1089). It was causing more bugs than it fixed. #1089 will be addressed in 2.0.

doc/guide/query-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ await Person
710710
}]);
711711
```
712712

713-
The query above will insert a pet named `I am the dog of Jennifer whose id is 523` for Jennifer. If `#ref{}` is used within a string, the references are replaced with the referred values inside the string. If the reference string contains nothing but the reference, the referred value is copied to it's place preserving its type.
713+
The query above will insert a pet named `I am the dog of Jennifer whose id is 523` for Jennifer. If `#ref{}` is used within a string, the references are replaced with the referred values inside the string. If the reference string contains nothing but the reference, the referred value is copied to its place preserving its type.
714714

715715
Existing rows can be related to newly inserted rows by using the `relate` option. `relate` can be `true` in which case all models in the graph that have an identifier get related. `relate` can also be an array of relation paths like `['children', 'children.movies.actors']` in which case only objects in those paths get related even if they have an idetifier.
716716

doc/recipes/extra-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Join table extra properties
22

3-
Sometimes when you have a many-to-many relationship, you want to store some properties in the join (pivot) table and still join them with the related objects. In objection, these proerties can be defined as `extra` properties of many-to-many relationship.
3+
Sometimes when you have a many-to-many relationship, you want to store some properties in the join (pivot) table and still join them with the related objects. In objection, these properties can be defined as `extra` properties of many-to-many relationship.
44

55
Let's consider a schema like this:
66

doc/recipes/returning-tricks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const deletedJennifers = await Person
5050
.where({firstName: 'Jennifer'})
5151
.returning('*');
5252

53-
console.log(deletedJennifers.length); // However many Jennifers there were
53+
console.log(deletedJennifers.length); // How many Jennifers there were
5454
console.log(deletedJennifers[0].lastName); // Maybe "Lawrence"
5555
```
5656

@@ -63,6 +63,6 @@ const jennsDeletedDogs = await jennifer
6363
.where({'species': 'dog'})
6464
.returning('*');
6565

66-
console.log(jennsDeletedDogs.length); // However many dogs Jennifer had
66+
console.log(jennsDeletedDogs.length); // How many dogs Jennifer had
6767
console.log(jennsDeletedDogs[0].name); // Maybe "Fido"
6868
```

lib/model/modelColPropMap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function columnNameToPropertyName(modelClass, columnName) {
1212
const props = Object.keys(model.$parseDatabaseJson(row));
1313
const propertyName = difference(props, addedProps)[0];
1414

15-
return propertyName || null;
15+
return propertyName || columnName;
1616
}
1717

1818
function propertyNameToColumnName(modelClass, propertyName) {
@@ -25,7 +25,7 @@ function propertyNameToColumnName(modelClass, propertyName) {
2525
const cols = Object.keys(model.$formatDatabaseJson(obj));
2626
const columnName = difference(cols, addedCols)[0];
2727

28-
return columnName || null;
28+
return columnName || propertyName;
2929
}
3030

3131
module.exports = {

0 commit comments

Comments
 (0)