Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 364c00e

Browse files
committed
Merge branches 'doc/db-ref' and 'master' of github.com:Vincit/objection.js into doc/db-ref
# Conflicts: # package.json
2 parents 1b35c8c + 84b91ae commit 364c00e

File tree

203 files changed

+5024
-3793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+5024
-3793
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ node_js:
1313
- '8'
1414
- '9'
1515
- '10'
16+
- '11'
1617

1718
before_script:
1819
- psql -U postgres -c "CREATE USER objection SUPERUSER"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/Vincit/objection.js.svg?branch=master)](https://travis-ci.org/Vincit/objection.js) [![Coverage Status](https://coveralls.io/repos/github/Vincit/objection.js/badge.svg?branch=master)](https://coveralls.io/github/Vincit/objection.js?branch=master) [![Join the chat at https://gitter.im/Vincit/objection.js](https://badges.gitter.im/Vincit/objection.js.svg)](https://gitter.im/Vincit/objection.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1+
[![Build Status](https://travis-ci.org/Vincit/objection.js.svg?branch=master)](https://travis-ci.org/Vincit/objection.js) [![Coverage Status](https://coveralls.io/repos/github/Vincit/objection.js/badge.svg?branch=master&service=github)](https://coveralls.io/github/Vincit/objection.js?branch=master) [![Join the chat at https://gitter.im/Vincit/objection.js](https://badges.gitter.im/Vincit/objection.js.svg)](https://gitter.im/Vincit/objection.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22

33
# [Objection.js](https://vincit.github.io/objection.js)
44

doc/includes/API.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ const [person1, person2] = await Person.query().findByIds([1, 2]);
454454
const [person1, person2] = await Person.query().findByIds([[1, '10'], [2, '10']]);
455455
```
456456

457+
Finds a list of items. The order of the returned items is not guaranteed to be the same as the order of the inputs.
458+
457459
##### Arguments
458460

459461
Argument|Type|Description
@@ -1169,7 +1171,7 @@ const numRelatedRows = await someMovie
11691171
console.log(`${numRelatedRows} rows were related`);
11701172
```
11711173

1172-
Relates an existing model to another model.
1174+
Relate (attach) an existing model to another model.
11731175

11741176
This method doesn't create a new instance but only updates the foreign keys and in
11751177
the case of many-to-many relation, creates a join row to the join table.
@@ -1211,9 +1213,9 @@ const numUnrelatedRows = await person.$relatedQuery('movies')
12111213
console.log('movie 50 is no longer related to person 123 through `movies` relation');
12121214
```
12131215

1214-
Removes a connection between two models.
1216+
Remove (detach) a connection between two rows.
12151217

1216-
Doesn't delete the models. Only removes the connection. For ManyToMany relations this
1218+
Doesn't delete the rows. Only removes the connection. For ManyToMany relations this
12171219
deletes the join row from the join table. For other relation types this sets the
12181220
join columns to null.
12191221

doc/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ What objection.js **doesn't** give you:
4545
to you. knex has a great [migration tool](http://knexjs.org/#Migrations) that we recommend for this job. Check
4646
out the [example project](https://github.com/Vincit/objection.js/tree/master/examples/express-es6).
4747

48-
Objection.js uses Promises and coding practices that make it ready for the future. We use Well known
49-
[OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) techniques and ES2015 classes and inheritance
48+
Objection.js uses Promises and coding practices that make it ready for the future. We use well known
49+
[OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) techniques, ES2015 classes, and inheritance
5050
in the codebase. You can use things like [async/await](http://jakearchibald.com/2014/es7-async-functions/)
5151
using node ">=7.6.0" or alternatively with a transpiler such as [Babel](https://babeljs.io/). Check out our [ES2015](https://github.com/Vincit/objection.js/tree/master/examples/express-es6)
5252
and [ESNext](https://github.com/Vincit/objection.js/tree/master/examples/express-es7) example projects.
@@ -1555,7 +1555,7 @@ await Person
15551555
}, options);
15561556
```
15571557

1558-
> Note that `upsertGraph` does not support the parameter `#dbRef` (which is supported by `insertGraph`). Use `relate` option and pass an id as depicted above instead.
1558+
> You can use `upsertGraph` with `#dbRef` (same way as when using `insertGraph`). Alternatively, you can use `relate` option and pass an id as depicted above.
15591559
15601560
> You can disable updates, inserts, deletes etc. for the whole `upsertGraph` operation or for
15611561
> individual relations by using the `noUpdate`, `noInsert`, `noDelete` etc. options. See

examples/express-es6/app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
const _ = require('lodash');
21
const Knex = require('knex');
32
const morgan = require('morgan');
43
const express = require('express');
5-
const Promise = require('bluebird');
64
const bodyParser = require('body-parser');
75
const promiseRouter = require('express-promise-router');
86
const knexConfig = require('./knexfile');

examples/express-es6/knexfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ module.exports = {
44
useNullAsDefault: true,
55
connection: {
66
filename: './example.db'
7+
},
8+
pool: {
9+
afterCreate: (conn, cb) => {
10+
conn.run('PRAGMA foreign_keys = ON', cb);
11+
}
712
}
813
},
914

examples/express-es6/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"knex": "^0.14.6",
2121
"lodash": "^4.17.4",
2222
"morgan": "^1.9.0",
23-
"objection": "^1.1.8",
24-
"sqlite3": "^4.0.0"
23+
"objection": "^1.4.0",
24+
"sqlite3": "^4.0.4"
2525
}
2626
}

examples/express-es7/knexfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ module.exports = {
44
useNullAsDefault: true,
55
connection: {
66
filename: './build/example.db'
7+
},
8+
pool: {
9+
afterCreate: (conn, cb) => {
10+
conn.run('PRAGMA foreign_keys = ON', cb);
11+
}
712
}
813
},
914

examples/express-es7/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"knex": "^0.14.6",
3232
"lodash": "^4.17.4",
3333
"morgan": "^1.9.0",
34-
"objection": "^1.1.8",
35-
"sqlite3": "^4.0.0"
34+
"objection": "^1.4.0",
35+
"sqlite3": "^4.0.4"
3636
},
3737
"devDependencies": {
3838
"babel-cli": "^6.26.0",

examples/express-ts/knexfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ module.exports = {
44
useNullAsDefault: true,
55
connection: {
66
filename: './example.db'
7+
},
8+
pool: {
9+
afterCreate: (conn, cb) => {
10+
conn.run('PRAGMA foreign_keys = ON', cb);
11+
}
712
}
813
},
914

0 commit comments

Comments
 (0)