@depup/bookshelf 1.2.0-depup.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,764 @@
1
+ ## Change Log
2
+
3
+ **1.2.0** <small>_Jun 07, 2020_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/1.1.1...1.2.0)
4
+
5
+ #### Features
6
+
7
+ - Add option to control auto refresh after save: [#2070](https://github.com/bookshelf/bookshelf/pull/2070)
8
+
9
+ #### Tests
10
+
11
+ - Adds some more integration tests to `Collection#fetch`: [#2079](https://github.com/bookshelf/bookshelf/pull/2079)
12
+
13
+ #### Dependencies
14
+
15
+ - Support Knex version 0.21.0 and up: [#2072](https://github.com/bookshelf/bookshelf/pull/2072)
16
+ - Update some dependencies of dependencies to fix security warnings: [#2078](https://github.com/bookshelf/bookshelf/pull/2078)
17
+
18
+ **1.1.1** <small>_Mar 28, 2020_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/1.1.0...1.1.1)
19
+
20
+ #### Bug fixes
21
+
22
+ - Fix attributes that are changed during event hook not being persisted: [#2062](https://github.com/bookshelf/bookshelf/pull/2062)
23
+ - Fix incorrect query object being sent to event handlers with `morphTo`: [#2059](https://github.com/bookshelf/bookshelf/pull/2059)
24
+ - Fix non-object attributes being passed to `model.parse()` in some cases: [#2056](https://github.com/bookshelf/bookshelf/pull/2056)
25
+
26
+ #### Documentation
27
+
28
+ - Fix typo in doclet: [#2057](https://github.com/bookshelf/bookshelf/pull/2057)
29
+
30
+ **0.15.2** <small>_Mar 28, 2020_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.15.1...0.15.2)
31
+
32
+ #### Bug fixes
33
+
34
+ - Fix attributes that are changed during event hook not being persisted: [#2063](https://github.com/bookshelf/bookshelf/pull/2063)
35
+
36
+ **1.1.0** <small>_Jan 31, 2020_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/1.0.1...1.1.0)
37
+
38
+ #### Features
39
+
40
+ - Add option to disable the count information in `fetchPage`: [#2045](https://github.com/bookshelf/bookshelf/pull/2045)
41
+
42
+ #### Tests
43
+
44
+ - Small refactor to some tests: [#2050](https://github.com/bookshelf/bookshelf/pull/2050)
45
+
46
+ #### Dependencies
47
+
48
+ - Update some dependencies to their latest versions: [#2053](https://github.com/bookshelf/bookshelf/pull/2053)
49
+ - Update Knex to version 0.20.8: [#2049](https://github.com/bookshelf/bookshelf/pull/2049)
50
+
51
+ **1.0.1** <small>_Oct 06, 2019_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/1.0.0...1.0.1)
52
+
53
+ #### Bug fixes
54
+
55
+ - Fix JSON.stringify causing TypeError in some cases: [#2029](https://github.com/bookshelf/bookshelf/pull/2029)
56
+
57
+ #### Documentation
58
+
59
+ - Add documentation for Model#id: [#2031](https://github.com/bookshelf/bookshelf/pull/2031)
60
+ - Fix number of arguments in Model#save doclet: [#2030](https://github.com/bookshelf/bookshelf/pull/2030)
61
+
62
+ #### Dependencies
63
+
64
+ - Update js-yaml to version 3.13.1: [#2023](https://github.com/bookshelf/bookshelf/pull/2023)
65
+ - Update handlebars to version 4.2.1: [#2022](https://github.com/bookshelf/bookshelf/pull/2022)
66
+ - Update uuid to version 3.3.3: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
67
+ - Update sqlite3 to version 4.1.0: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
68
+ - Update sinon to 7.4.2: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
69
+ - Update prettier to 1.18.2: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
70
+ - Update mocha to version 6.2.0: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
71
+ - Update lint-staged to version 9.2.5: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
72
+ - Update jsdoc to version 3.6.3: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
73
+ - Update husky to version 3.0.5: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
74
+ - Update eslint-plugin-prettier to version 3.1.1: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
75
+ - Update eslint-config-prettier to version 6.3.0: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
76
+ - Update eslint to version 6.4.0: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
77
+ - Update chai to 4.2.0: [#2021](https://github.com/bookshelf/bookshelf/pull/2021)
78
+ - Update eslint-utils from 1.3.1 to 1.4.2: [#2020](https://github.com/bookshelf/bookshelf/pull/2020)
79
+
80
+ **1.0.0** <small>_Sep 13, 2019_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.15.1...1.0.0)
81
+
82
+ #### Breaking changes
83
+
84
+ - This version requires Node.js 8+ **if** using a Knex version greater than 0.18.4, otherwise Node.js 6 is still supported: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
85
+ - Make `require: true` the default for Model#fetch: [#2006](https://github.com/bookshelf/bookshelf/pull/2006)
86
+ - Remove some Model and Collection lodash based methods: [#2005](https://github.com/bookshelf/bookshelf/pull/2005)
87
+ - Change Collection#where so it behaves like Model#where: [#2001](https://github.com/bookshelf/bookshelf/pull/2001)
88
+ - Move all plugins to their own repositories: [#2000](https://github.com/bookshelf/bookshelf/pull/2000)
89
+ - Promote some useful plugins to core: [#1992](https://github.com/bookshelf/bookshelf/pull/1992), [#1993](https://github.com/bookshelf/bookshelf/pull/1993), [#1996](https://github.com/bookshelf/bookshelf/pull/1996)
90
+
91
+ #### Enhancements
92
+
93
+ - Refresh model attributes after a save operation: [#2012](https://github.com/bookshelf/bookshelf/pull/2012)
94
+
95
+ #### Bug fixes
96
+
97
+ - Fix missing columns after save: [#2012](https://github.com/bookshelf/bookshelf/pull/2012)
98
+ - Fix Case Converter plugin overriding any previously defined parse methods: [#2000](https://github.com/bookshelf/bookshelf/pull/2000), [case-converter-plugin@1.0.0](https://github.com/bookshelf/case-converter-plugin/releases/tag/v1.0.0)
99
+ - Fix registry saving models inadvertently across different bookshelf instances: [#1996](https://github.com/bookshelf/bookshelf/pull/1996)
100
+
101
+ #### Documentation
102
+
103
+ - Add example of how to use custom collections: [#2015](https://github.com/bookshelf/bookshelf/pull/2015)
104
+ - Improve documentation related to debug mode: [#2014](https://github.com/bookshelf/bookshelf/pull/2014)
105
+ - Add note that count methods return String with Postgres: [#2013](https://github.com/bookshelf/bookshelf/pull/2013)
106
+ - Fix typo in Readme: [#1998](https://github.com/bookshelf/bookshelf/pull/1998)
107
+ - Better Plugin Docs: [#1992](https://github.com/bookshelf/bookshelf/pull/1992), [#1993](https://github.com/bookshelf/bookshelf/pull/1993), [#1996](https://github.com/bookshelf/bookshelf/pull/1996), [#2000](https://github.com/bookshelf/bookshelf/pull/2000)
108
+
109
+ #### Dependencies
110
+
111
+ - Update lint-staged to version 9.1.0: [#1994](https://github.com/bookshelf/bookshelf/pull/1994)
112
+ - Update bluebird to 3.5.5: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
113
+ - Update lodash to 4.17.14: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
114
+ - Update mocha to version 6.1.4: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
115
+ - Update mysql to version 2.17.1: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
116
+ - Update pg to version 7.11.0: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
117
+ - Update sinon to version 7.3.2: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
118
+ - Update sinon-chai to version 3.3.0: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
119
+ - Update sqlite3 to version 4.0.9: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
120
+ - Update uuid to version 3.3.2: [#1991](https://github.com/bookshelf/bookshelf/pull/1991)
121
+ - Update eslint-config-prettier to 6.0.0: [#1957](https://github.com/bookshelf/bookshelf/pull/1987)
122
+ - Update eslint to version 6.0.0: [#1986](https://github.com/bookshelf/bookshelf/pull/1986)
123
+
124
+ **0.15.1** <small>_Jun 13, 2019_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.15.0...0.15.1)
125
+
126
+ - Update husky to version 2.4.1: [#1984](https://github.com/bookshelf/bookshelf/pull/1984)
127
+ - Bump supported knex version to 0.17: [#1982](https://github.com/bookshelf/bookshelf/pull/1982)
128
+
129
+ **0.15.0** <small>_Jun 13, 2019_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.14.2...0.15.0)
130
+
131
+ #### Breaking changes
132
+
133
+ - This version requires Node.js 6+
134
+ - Remove code that has been deprecated for a long time: [#1956](https://github.com/bookshelf/bookshelf/pull/1956)
135
+
136
+ #### Bug fixes
137
+
138
+ - `once` removes all events after it has been triggered: [#1972](https://github.com/bookshelf/bookshelf/pull/1972)
139
+ - Pagination details are wrong when selecting distinct values of a column: [#1950](https://github.com/bookshelf/bookshelf/pull/1950)
140
+ - Fix missing attributes in some events: [#1934](https://github.com/bookshelf/bookshelf/pull/1934)
141
+
142
+ #### Test Suite
143
+
144
+ - Fix Docker-compose.yml default postgres user: [#1972](https://github.com/bookshelf/bookshelf/pull/1972)
145
+ - Fix JSON tests on PostgreSQL 10+: [#1955](https://github.com/bookshelf/bookshelf/pull/1955)
146
+
147
+ #### Documentation
148
+
149
+ - Update and fix a lot of doclets: [#1951](https://github.com/bookshelf/bookshelf/pull/1951)
150
+ - Update README.md: [#1940](https://github.com/bookshelf/bookshelf/pull/1940)
151
+
152
+ #### Dependencies
153
+
154
+ - Update mocha to version 6.1.1: [#1968](https://github.com/bookshelf/bookshelf/pull/1968)
155
+ - Update eslint-config-prettier to 4.1.0: [#1957](https://github.com/bookshelf/bookshelf/pull/1957)
156
+ - Update sinon to version 7.2.4: [#1947](https://github.com/bookshelf/bookshelf/pull/1947)
157
+ - Update eslint to version 5.1.0: [#1930](https://github.com/bookshelf/bookshelf/pull/1930)
158
+
159
+ **0.14.2** <small>_Dec 17, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.14.1...0.14.2)
160
+
161
+ #### Bug fixes
162
+
163
+ - Fix crash when using `groupBy` with table qualifier in pagination plugin: [#1928](https://github.com/bookshelf/bookshelf/pull/1928)
164
+ - Fix `undefined` transaction object with Knex 0.15+: [#1926](https://github.com/bookshelf/bookshelf/pull/1926)
165
+
166
+ #### Refactoring
167
+
168
+ - Refactor logic behind `.timestamp()`'s decision for when to update the `updated_at` column: [#1892](https://github.com/bookshelf/bookshelf/pull/1892)
169
+
170
+ **0.14.1** <small>_Dec 09, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.14.0...0.14.1)
171
+
172
+ #### Enhancements
173
+
174
+ - Allow passing custom options to the pagination plugin's internal count method. This is useful for better interoperability with other plugins: [#1914](https://github.com/bookshelf/bookshelf/pull/1914)
175
+
176
+ #### Bug fixes
177
+
178
+ - Fix `withRelated` fetch option not always grouping properly when using binary primary keys: [#1918](https://github.com/bookshelf/bookshelf/pull/1918)
179
+
180
+ #### Documentation
181
+
182
+ - Add a basic Events guide and fix some issues with the events doclets: [#1917](https://github.com/bookshelf/bookshelf/pull/1917)
183
+
184
+ **0.14.0** <small>_Dec 09, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.13.3...0.14.0)
185
+
186
+ #### Breaking changes
187
+
188
+ - The `previous()` and `previousAttributes()` methods were changed so that whenever a model is saved or destroyed the previous attributes are no longer reset to the current attributes. Since the old behavior wasn't very useful it's likely this won't cause issues for many people. There's a [migration guide](https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.13.3-to-0.14.0#previous-and-previousattributes) in case you are affected by this change. [#1848](https://github.com/bookshelf/bookshelf/pull/1848)
189
+ - Fix incorrect results in collection when models have duplicate ids. Checkout the [migration guide](https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.13.3-to-0.14.0#passing-merge-false-remove-false-to-collectionset-and-default-behavior-with-duplicates) in case you are affected by this. [#1846](https://github.com/bookshelf/bookshelf/pull/1846)
190
+ - Empty `hasOne` relation will now return `null` instead of `{}` when serialized: [#1839](https://github.com/bookshelf/bookshelf/pull/1839). There's a [migration guide](https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.13.3-to-0.14.0#return-value-for-empty-hasone-relation) in the rare event this causes you problems.
191
+ - Add more helpful error messages on bad or insufficient `morphTo` data: [#1824](https://github.com/bookshelf/bookshelf/pull/1824). There's a [migration guide](https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.13.3-to-0.14.0#new-error-messages-on-bad-or-insufficient-morphto-data) in case you are affected by this.
192
+ - Changed the existing functionality so that saving a model that hasn't changed will not update its `updated_at` attribute: [#1798](https://github.com/bookshelf/bookshelf/pull/1798). Checkout the [migration guide](https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.13.3-to-0.14.0#saving-a-model-that-hasnt-changed-wont-update-updated_at) in case you are affected by this.
193
+
194
+ #### Enhancements
195
+
196
+ - Make collections iterable using `for ... of` loops: [#1830](https://github.com/bookshelf/bookshelf/pull/1830)
197
+ - Add row-level locking options: [#1810](https://github.com/bookshelf/bookshelf/pull/1810)
198
+
199
+ #### Bug fixes
200
+
201
+ - Return clones of nested objects in `previousAttributes()`: [#1876](https://github.com/bookshelf/bookshelf/pull/1876)
202
+ - Fix incorrect `rowCount` value when using `groupBy` with `fetchPage()`: [#1852](https://github.com/bookshelf/bookshelf/pull/1852)
203
+ - Fix eager loading of relations when using `parse`/`format`: [#1838](https://github.com/bookshelf/bookshelf/pull/1838)
204
+ - Fix inability to install bookshelf from git commit: [#1835](https://github.com/bookshelf/bookshelf/pull/1835)
205
+ - Fix `timestamp()` setting a key named `"null"` in some cases: [#1820](https://github.com/bookshelf/bookshelf/pull/1820)
206
+ - Fix performance of including relationships: [#1800](https://github.com/bookshelf/bookshelf/pull/1800)
207
+
208
+ #### Test Suite
209
+
210
+ - Add test to check for adding `withRelated` inside events: [#1853](https://github.com/bookshelf/bookshelf/pull/1853)
211
+ - Add Node.js 10 to the Travis config: [#1829](https://github.com/bookshelf/bookshelf/pull/1829)
212
+ - Fix incorrect output ordering in tests in some cases: [#1825](https://github.com/bookshelf/bookshelf/pull/1825)
213
+
214
+ #### Documentation
215
+
216
+ - Change the JSDoc theme to add a Guides section (this was already released): [#1909](https://github.com/bookshelf/bookshelf/pull/1909)
217
+ - Fix `hasOne`'s doc: [#1890](https://github.com/bookshelf/bookshelf/pull/1890)
218
+ - Fix many-to-many tutorial code: [#1888](https://github.com/bookshelf/bookshelf/pull/1888)
219
+ - Add code syntax highlighting for tutorials: [#1850](https://github.com/bookshelf/bookshelf/pull/1850)
220
+ - Fix a few issues with the collection documentation: [#1836](https://github.com/bookshelf/bookshelf/pull/1836)
221
+ - Fix `Model.load()` relations param: [#1834](https://github.com/bookshelf/bookshelf/pull/1834)
222
+ - Fix incorrect docs for collection:fetching event: [#1831](https://github.com/bookshelf/bookshelf/pull/1831)
223
+ - Add note on needing the Pagination plugin to use `fetchPage()`: [#1803](https://github.com/bookshelf/bookshelf/pull/1803)
224
+ - Fix incorrect data types and undocumented Model property: [#1797](https://github.com/bookshelf/bookshelf/pull/1797)
225
+
226
+ #### Dependencies
227
+
228
+ - Replace turbocolor with colorette: [#1904](https://github.com/bookshelf/bookshelf/pull/1904)
229
+ - Use prettier to format all `js` and `json` files: [#1883](https://github.com/bookshelf/bookshelf/pull/1883)
230
+ - Replace chalk with turbocolor: [#1878](https://github.com/bookshelf/bookshelf/pull/1878)
231
+ - Update some insecure dependencies: [#1841](https://github.com/bookshelf/bookshelf/pull/1841)
232
+ - Replace Babel with Node 4 compatible JavaScript: [#1835](https://github.com/bookshelf/bookshelf/pull/1835)
233
+ - Update sinon to the latest version: [#1833](https://github.com/bookshelf/bookshelf/pull/1833)
234
+
235
+ **0.13.3** <small>_Mar 26, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.13.2...0.13.3)
236
+
237
+ #### Potentially breaking changes
238
+ - Saving a model that hasn't changed will not update its `updated_at` attribute. This was included in a patch release because the chances of any applications depending on this behavior are very small: [#1798](https://github.com/bookshelf/bookshelf/pull/1798)
239
+
240
+ #### Bug fixes
241
+ - Clean up automatic timestamps feature: [#1798](https://github.com/bookshelf/bookshelf/pull/1798)
242
+
243
+ #### Documentation
244
+ - Expand documentation of the automatic timestamps feature: [#1798](https://github.com/bookshelf/bookshelf/pull/1798)
245
+
246
+ **0.13.2** <small>_Mar 23, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.13.0...0.13.2)
247
+
248
+ #### Bug fixes
249
+ - Fix timestamps set with Invalid Date in some cases: [#1796](https://github.com/bookshelf/bookshelf/pull/1796)
250
+
251
+ #### Documentation
252
+ - Fix incorrect data types and undocumented Model#defaults property: [#1797](https://github.com/bookshelf/bookshelf/pull/1797)
253
+
254
+ **0.13.0** <small>_Mar 18, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.12.1...0.13.0)
255
+
256
+ #### Breaking changes
257
+
258
+ - Make `require: true` the default when deleting models: [#1779](https://github.com/bookshelf/bookshelf/pull/1779)
259
+ - Remove the second argument to the model's destroyed event handler: [#1777](https://github.com/bookshelf/bookshelf/pull/1777)
260
+ - Events are now triggered sequentially even when the handlers execute asynchronous code: [#1768](https://github.com/bookshelf/bookshelf/pull/1768)
261
+ - Drop support for Node versions older than 4: [#1696](https://github.com/bookshelf/bookshelf/pull/1696)
262
+ - Reorder `saving` and `creating` events to reflect the documentation: [#1142](https://github.com/bookshelf/bookshelf/pull/1142)
263
+
264
+ #### Enhancements
265
+
266
+ - Only request `returning` attribute if client supports `returning`: [#1770](https://github.com/bookshelf/bookshelf/pull/1770)
267
+ - Throw error if user doesn't pass a valid Knex instance on initialize: [#1756](https://github.com/bookshelf/bookshelf/pull/1756)
268
+ - Add parameterized virtual properties to virtuals plugin: [#1755](https://github.com/bookshelf/bookshelf/pull/1755)
269
+ - Add individual attribute processor plugin to core: [#1741](https://github.com/bookshelf/bookshelf/pull/1741)
270
+ - Format `idAttribute` on save and delete: [#1680](https://github.com/bookshelf/bookshelf/pull/1680)
271
+ - Add `withSchema` option to all database operations: [#1638](https://github.com/bookshelf/bookshelf/pull/1638)
272
+ - Add a case converter plugin to core: [#1093](https://github.com/bookshelf/bookshelf/pull/1093)
273
+
274
+ #### Bug fixes
275
+ - Fix inconsistent timestamp values between save and fetch: [#1784](https://github.com/bookshelf/bookshelf/pull/1784)
276
+ - Set `model.id` if attributes being `.set()` contain a parsed version of `idAttribute`: [#1760](https://github.com/bookshelf/bookshelf/pull/1760)
277
+ - Fix pagination plugin's `fetchPage()` ignoring or hanging with transactions: [#1625](https://github.com/bookshelf/bookshelf/pull/1625)
278
+ - Fix `fetchPage()` from pagination plugin not working for relation collections: [#1561](https://github.com/bookshelf/bookshelf/pull/1561)
279
+ - Don't try to update `idAttribute` if it hasn't changed: [#1260](https://github.com/bookshelf/bookshelf/pull/1260)
280
+
281
+ #### Test suite
282
+
283
+ - Increase timeout of the large arrays test: [#1778](https://github.com/bookshelf/bookshelf/pull/1778)
284
+ - Add test to verify that `parentId` is not undefined when using `fetchAll` with relations: [#1769](https://github.com/bookshelf/bookshelf/pull/1769)
285
+ - Fixes and general improvements to the test suite: [#1753](https://github.com/bookshelf/bookshelf/pull/1753)
286
+ - Remove OracleDB tests: [#1744](https://github.com/bookshelf/bookshelf/pull/1744)
287
+ - Fix invalid test related to dirty attributes: [#1312](https://github.com/bookshelf/bookshelf/pull/1312)
288
+
289
+ #### Documentation
290
+ - Improve docs about running tests: [#1761](https://github.com/bookshelf/bookshelf/pull/1761)
291
+ - Fix typo on parse-and-format tutorial: [#1748](https://github.com/bookshelf/bookshelf/pull/1748)
292
+ - Add Bookshelf Manager to list of community plugins: [#1747](https://github.com/bookshelf/bookshelf/pull/1747)
293
+
294
+ #### Dependencies
295
+
296
+ - Update some dependencies: [#1787](https://github.com/bookshelf/bookshelf/pull/1787), [#1782](https://github.com/bookshelf/bookshelf/pull/1782), [#1780](https://github.com/bookshelf/bookshelf/pull/1780), [#1767](https://github.com/bookshelf/bookshelf/pull/1767) [#1746](https://github.com/bookshelf/bookshelf/pull/1746), [#1730](https://github.com/bookshelf/bookshelf/pull/1730)
297
+
298
+ **0.12.1** <small>_Jan 8, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.12.0...0.12.1)
299
+
300
+ #### Documentation
301
+ - Fix incorrect value of second argument to model event handlers: [#1723](https://github.com/bookshelf/bookshelf/pull/1723)
302
+ - Fix incorrect return value from `.detach()`: [#1720](https://github.com/bookshelf/bookshelf/pull/1720)
303
+ - Fix incorrect return value from `model.has()`: [#1712](https://github.com/bookshelf/bookshelf/pull/1712)
304
+ - Fix `fetching:collection` and `fetched:collection` not being generated or visible on the navigation bar: [#1114](https://github.com/bookshelf/bookshelf/pull/1114)
305
+ - Update contributing document and issue templates: [#1736](https://github.com/bookshelf/bookshelf/pull/1736)
306
+ - Add more information and links to Parse and Format docs: [#1727](https://github.com/bookshelf/bookshelf/pull/1727)
307
+ - Add bookshelf-ez-fetch to Community Plugins: [#1708](https://github.com/bookshelf/bookshelf/pull/1708)
308
+ - Add bookshelf-default-select to Community Plugins: [#1706](https://github.com/bookshelf/bookshelf/pull/1706)
309
+ - Add information and examples about calling `super()` on model's `initialize()`: [#1529](https://github.com/bookshelf/bookshelf/pull/1529)
310
+ - Add npm version badge to readme: [f4dd792](https://github.com/bookshelf/bookshelf/commit/f4dd79267ad8267a7073dd5c9f0661f6591ae96f)
311
+
312
+ #### Bug fixes
313
+ - Fix inability to attach belongsToMany relation to models fetched with `fetchAll()`: [#1716](https://github.com/bookshelf/bookshelf/pull/1716)
314
+ - Fix foreign key = 0 not fetching related object: [#1639](https://github.com/bookshelf/bookshelf/pull/1639)
315
+ - Fix unparsed `previousAttributes` for related models: [#1457](https://github.com/bookshelf/bookshelf/pull/1457)
316
+
317
+ #### Dependencies
318
+ - Update some dependencies: [#1734](https://github.com/bookshelf/bookshelf/pull/1734), [#1733](https://github.com/bookshelf/bookshelf/pull/1733), [#1732](https://github.com/bookshelf/bookshelf/pull/1732), [#1728](https://github.com/bookshelf/bookshelf/pull/1728), [#1726](https://github.com/bookshelf/bookshelf/pull/1726)
319
+
320
+ **0.12.0** <small>_Nov 27, 2017_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.11.1...0.12.0)
321
+
322
+ - Skip visibility-plugin `hidden` and `visible` attributes [#1699](https://github.com/bookshelf/bookshelf/pull/1699).
323
+ - Used w/ `<model>.toJSON({ visibility: false })`
324
+ - Updated knex peer dependency version to 0.14.x [#1694](https://github.com/bookshelf/bookshelf/pull/1694).
325
+ - Documentation typo fixes [#1693](https://github.com/bookshelf/bookshelf/pull/1693).
326
+ - Now caching `node_modules` to speed up travis-ci builds [#1695](https://github.com/bookshelf/bookshelf/pull/1695).
327
+ - Use Docker containers for test runs [#1674](https://github.com/bookshelf/bookshelf/pull/1674).
328
+ - Make `postpublish` work regardless of git remote config [#1697](https://github.com/bookshelf/bookshelf/pull/1697).
329
+
330
+ **0.11.1** <small>_Nov 15, 2017_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.11.0...0.11.1)
331
+
332
+ - Fixed regression #1691: File missing on `postinstall`
333
+ - npm `postinstall` script can be run as a part of npm `prepublish` script.
334
+
335
+ **0.11.0** <small>_Nov 15, 2017_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.10.4...0.11.0)
336
+
337
+ - Moved `.babelrc` -> `src/.babelrc` [#1470](https://github.com/bookshelf/bookshelf/pull/1470)
338
+ - Timestamp on save now utilizes a date option for timestamp updates on insert and update. [#1592](https://github.com/bookshelf/bookshelf/pull/1592)
339
+ - Used in options on save like so: ```m.save({item: 'test'}, { date: dateInThePast })```
340
+ - Added `morphValues` for `morphTo` relation. [#1326](https://github.com/bookshelf/bookshelf/pull/1326)
341
+ - Added ability to also set timestamps as model attributes in save.
342
+ - Removed non-production files from packaging / added them to .npmignore [#1679](https://github.com/bookshelf/bookshelf/pull/1679)
343
+ - Development Facing:
344
+ - Oracle tests only run when oracle is installed.
345
+ - Refactoring on the registry plugin.
346
+ - Updated a lot of documents related to repo organization.
347
+
348
+ **0.10.4** - <small>_Jul 17, 2017_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.10.3...0.10.4)
349
+
350
+ - Allow knex 0.13.x.
351
+ - Use uuid instead of node-uuid.
352
+ - Test Bookshelf with Node v7.
353
+ - Updated Author info in `package.json`.
354
+ - Remove lodash from build script.
355
+ - Add OracleDB integration tests.
356
+ - Add opportunity to override `visible` and `hidden` behavior for toJSON function.
357
+ - Do not load `belongsTo` if `foreignKey` is `null`.
358
+ - Optimise `timestamp` function: respect updated_at/created_at being part of the query.
359
+ - Fix `fetchPage` on Collection (pagination plugin).
360
+ - Fixing virtuals when `omitNew=true`.
361
+ - Lot's of typo fixes and documentation updates.
362
+
363
+ **0.10.3** - <small>_Jan 21, 2017_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.10.2...0.10.3)
364
+
365
+ - Drop Node support for 0.10 and 0.12.
366
+ - Trigger creating event for attached models.
367
+ - Add support for uninstantiated models relations.
368
+ - Add `foreignKeyTarget` to relation methods.
369
+
370
+ **0.10.2** - <small>_Sept 22, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.10.1...0.10.2)
371
+
372
+ - Fixes memory leak introduced in 0.10.0 caused by binding `this.listeners` in `triggerThen`.
373
+ - Fixes Bluebird warning when a Promise was internally rejected with a non-error.
374
+
375
+ **0.10.1** - <small>_Sept 14, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.10.0...0.10.1)
376
+
377
+ - Allows using knex 0.12 as a peerDependency.
378
+ - knex instance used by bookshelf may be swapped out.
379
+
380
+ **0.10.0** — <small>_Jun 29, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.5...0.10.0)
381
+
382
+ #### Breaking Changes
383
+ - Removal/renaming of certain lodash functions from Model and Collection that were removed in lodash 4:
384
+ - Collection Methods
385
+ - removed `CollectionBase#collect` => use `CollectionBase#map` instead
386
+ - removed `CollectionBase#foldl` => use `CollectionBase#reduce` instead
387
+ - removed `CollectionBase#inject` => use `CollectionBase#reduce` instead
388
+ - removed `CollectionBase#foldr` => use `CollectionBase#reduceRight` instead
389
+ - removed `CollectionBase#detect` => use `CollectionBase#find` instead
390
+ - removed `CollectionBase#select` => use `CollectionBase#filter` instead
391
+ - removed `CollectionBase#all` => use `CollectionBase#every` instead
392
+ - removed `CollectionBase#any` => use `CollectionBase#some` instead
393
+ - removed `CollectionBase#include` => use `CollectionBase#includes` instead
394
+ - removed `CollectionBase#contains` => use `CollectionBase#includes` instead
395
+ - removed `CollectionBase#rest` => use `CollectionBase#tail instead`
396
+ - renamed `CollectionBase#invoke` => `CollectionBase#invokeMap`
397
+ - split `CollectionBase#max` into `CollectionBase#maxBy` - see the [lodash docs](https://lodash.com/docs/#max) for more explanation
398
+ - split `CollectionBase#min` into `CollectionBase#minBy` - see the [lodash docs](https://lodash.com/docs/#min) for more explanation
399
+ - Model Methods
400
+ - renamed `ModelBase#pairs` => `ModelBase#toPairs`
401
+
402
+ #### Other changes
403
+ - Update to Lodash 4. #1287
404
+ - Registry plugin: Better support for custom relations. #1294
405
+
406
+ **0.9.5** — <small>_May 15, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.4...0.9.5)
407
+
408
+ - Add pagination plugin. #1183
409
+ - Fire {@link Model#event:fetched} on eagerly loaded relations. #1206
410
+ - Correct cloning of {@link Model#belongsToMany} decorated relations. #1222
411
+ - Update Knex to 0.11.x. #1227
412
+ - Update minimum lodash version. #1230
413
+
414
+ **0.9.4** — <small>_April 3, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.3...0.9.4)
415
+
416
+ - Include `babel-runtime` as a dependency. #1188
417
+
418
+ **0.9.3** — <small>_April 3, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.2...0.9.3)
419
+
420
+ - Bugfix: Restore support for `camelCase` and `colon:separated` event names. #1184
421
+
422
+ **0.9.2** — <small>_February 17, 2016_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.1...0.9.2)
423
+
424
+ - Permit up to Knex 0.11.0 via `peerDependencies`.
425
+ - `Model.forge` works for ES6 classes. #924
426
+ - Fix `Collection#count` for `hasMany` relations. #1115
427
+
428
+ **0.9.1** — <small>_November 4, 2015_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.9.0...0.9.1)
429
+
430
+ - {@link Events#off} can now unregister multiple methods at once. #983
431
+ - Permit Knex 0.10.0 via `peerDependencies`. #998
432
+
433
+ **0.9.0** — <small>_November 1, 2015_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.8.2...0.9.0)
434
+
435
+ - Repo no longer includes built source or generated documentation. Release script updated to include these only in the tagged release commit. #950.
436
+ - {@link Model#previous} returned `undefined` instead of `null` for non-existent attributes.
437
+ - Update tests and documentation to confirm that `null` (rather than `undefined`) is returned from {@link Model#fetch} and {@link Collection#fetchOne}.
438
+ - Fix error in virtuals plugin - #936
439
+ - Correct error updating parsed/formatted {@link Model#idAttribute} after successful `insert` operation. #955
440
+ - Many documentation fixes.
441
+
442
+ **0.8.2** — <small>_August 20, 2015_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.8.1...0.8.2)
443
+
444
+ - ES6/7: Move code base to `/src` — code is now compiled into `/lib` via [Babel](https://babeljs.io/).
445
+ - Add `collection.count`, `model.count` and `Model.count`.
446
+ - Add `model.refresh`. #796
447
+ - Prevent `fetch` and `refresh` from trying to add JSON attributes to a `where` clause. #550 #778
448
+ - Virtuals plugin now supports `{patch: true}` argument to `model.save`. #542
449
+ - Restored `model.clone` and `collection.clone`, which were not previously working. #744
450
+ - Allow `bookshelf.Collection` to be modified and extended by plugins (so that relations and `fetchAll` operations will return the extended instance). #681 #688
451
+ - Fix `model.timestamps` behavior which deviated from documentation. Also ensure that `createdAt` is set when `{method: "insert"}` is passed explicitly. #787
452
+ - Calling `create` on a `through` relationship no longer tries to make a pivot object. Previously this would attempt to create an object with invalid foreign keys. #768
453
+ - Parse foreign keys set during `create` in a relation. #770
454
+
455
+ **0.8.1** — <small>_May 12, 2015_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.8.0...0.8.1)
456
+
457
+ - Fix for regression in `initialize` not being called in Collection constructor, #737.
458
+ - Fix for regression, removing `omitPivot` in 0.8 #721
459
+ - Added `serialize`, a method which contains toJSON logic for easier customization.
460
+
461
+ **0.8.0** — <small>_May 1, 2015_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.9...0.8.0)
462
+
463
+ - Dropped Backbone dependency.
464
+ - More specific errors throughout, #522
465
+ - Support `{require: true}` for model.destroy #617
466
+ - Add lifecycle events on pivot models for `belongsToMany`, `.through` #578
467
+ - Allows for select/column calls in the query builder closure, #633.
468
+ - Added per-constructor error classes #694 (note: this will not work in CoffeeScript).
469
+
470
+ #### Breaking Changes
471
+
472
+ - Removed the `__super__` internal property on the constructor, this shouldn't have been something you were relying on anyway.
473
+
474
+ **0.7.9** — <small>_Oct 28, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.8...0.7.9)
475
+
476
+ - Fix for regression in columns / eager fetch query constraints, (#510).
477
+
478
+ **0.7.8** — <small>_Oct 28, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.7...0.7.8)
479
+
480
+ - Timestamp `created_at` is now saved with any insert.
481
+ - Fix for regression created by #429.
482
+ - New events, `attaching`, `attached`, `detaching`, `detached` #452.
483
+ - Ability to specify custom column names in morphTo, #454
484
+ - Fix for stack overflow with model list as arguments, #482
485
+ - Modified location of eager fetch query constraints internally.
486
+
487
+ **0.7.7** — <small>_July 23, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.6...0.7.7)
488
+
489
+ - Fix for formatting on polymorphic keys, (#429).
490
+ - Added a resolve method for specifying a custom resolver function for the registry plugin.
491
+
492
+ **0.7.6** — <small>_June 29, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.5...0.7.6)
493
+
494
+ - Add `omitPivot` flag on toJSON options for omitting the `_pivot_` keys in `through` and `belongsToMany` relations (#404).
495
+
496
+ **0.7.5** — <small>_June 23, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.4...0.7.5)
497
+
498
+ - Fix missing `NotFoundError` & `EmptyError` on Model & Collection, respectively (#389, #399).
499
+
500
+ **0.7.4** — <small>_June 18, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.3...0.7.4)
501
+
502
+ - Added `bookshelf.model(name, protoProps, [staticProps])` syntax for registry plugin.
503
+
504
+ **0.7.3** — <small>_June 17, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.2...0.7.3)
505
+
506
+ - Fix for collection dropping models early in set, #376.
507
+
508
+ **0.7.2** — <small>_June 12, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.1...0.7.2)
509
+
510
+ - Pass a cloned copy of the model's attributes to `format` rather than the original, related to #315.
511
+
512
+ **0.7.1** — <small>_June 10, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.7.0...0.7.1)
513
+
514
+ - Ensure the knex version >= 0.6.10, where a major regression affecting column names was fixed.
515
+
516
+ **0.7.0** — <small>_June 9, 2014_</small>
517
+
518
+ - Added {@link Model#fetchAll}, for fetching a collection of models from a model.
519
+ - Added {@link Model#where}, as a shortcut for the most commonly used {@linkplain Model#query query method}.
520
+ - Initializing via a plain options object is deprecated, you must now pass in an initialized knex instance.
521
+ - Adding typed errors (#221).
522
+ - Upgrade to support knex 0.6.x
523
+
524
+ **0.6.12** — <small>_June 5, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.11...0.6.12)
525
+
526
+ - Fix for eager loaded `belongsTo` relation bug with custom parse/format (#377).
527
+
528
+ **0.6.11** — <small>_June 4, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.10...0.6.11)
529
+
530
+ - Temporarily add knex to `peerDependencies` until 0.7 is released to support knex 0.6 and there exists a better internal method of doing a semver check.
531
+ - Fix for `belongsTo` relation bug (#353).
532
+
533
+ **0.6.10** — <small>_April 3, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.9...0.6.10)
534
+
535
+ - Bumping dependencies, including upgrading to Bluebird 1.2, trigger-then 0.3, fixing an erroneous "unhandledRejection" (#310).
536
+ - `fetchOne` properly resets the query on the collection, (#300).
537
+
538
+ **0.6.9** — <small>_April 3, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.8...0.6.9)
539
+
540
+ - Only prefix model fields with the "tableName" after format has been called, (#308).
541
+
542
+ **0.6.8** — <small>_March 6, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.7...0.6.8)
543
+
544
+ - Virtuals plugin may now accept a hash of attributes to set.
545
+ - Properly fix issue addressed in 0.6.7.
546
+
547
+ **0.6.7** — <small>_March 2, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.6...0.6.7)
548
+
549
+ - Bugfix for edge case for eager loaded relations and `relatedData` settings.
550
+
551
+ **0.6.6** — <small>_March 1, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.5...0.6.6)
552
+
553
+ - Bugfix for registry plugin, resolving correct models for "through" relations. (#260)
554
+
555
+ **0.6.5** — <small>_February 28, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.4...0.6.5)
556
+
557
+ - Added {@link Collection#reduceThen} as a passthrough to Bluebird's "reduce" method with models.
558
+ - Options are now passed to "plugin" method. (#254)
559
+ - Bugfix for registry plugin. (#259)
560
+
561
+ **0.6.4** — <small>_February 11, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.3...0.6.4)
562
+
563
+ - Adds static method {@link Model.collection Model.collection()} as a shortcut for creating a collection with the current model.
564
+
565
+ **0.6.3** — <small>_February 9, 2014_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.2...0.6.3)
566
+
567
+ - Added an` Relation#updatePivot` method for updating tables on a "belongsToMany" relation. (#134, #230)
568
+ - Allow mutating the options for passing constraints to eager loaded relations. (#151)
569
+ - All keys of an object passed into sync are properly prefixed before sync. (#177)
570
+ - Clearer error messages for debugging. (#204, #197)
571
+ - Fixed error message for updates that don't affect rows. (#228)
572
+ - Group by the correct key on "belongsTo.through" relations. (#214)
573
+ - Ability to only use `created_at` or `updated_at` as timestamp properties. (#158)
574
+ - Numerous documentation corrections, clarifications, enhancements.
575
+ - Bumped Bluebird dependency to ~1.0.0.
576
+
577
+ **Plugins:**
578
+
579
+ - Added the `registry` plugin for registering models as strings, helping with the circular dependency problem.
580
+ - Added the `virtuals` plugin for getting/setting virtual (computed) properties on the model.
581
+ - Added the `visibility` plugin for specifying a whitelist/blacklist of keys when a model is serialized with toJSON.
582
+
583
+ **0.6.2** — <small>_December 18, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.1...0.6.2)
584
+
585
+ - Debug may now be passed as an option in any sync method, to log queries, including relations.
586
+ - Save now triggers an error in updates with no affected rows. (#119)
587
+ - The `model.id` attribute is only set on insert if it's empty. (#130)
588
+ - Ensure eager loaded relations can use attach/detach. (#120)
589
+
590
+ **0.6.1** — <small>_November 26, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.6.0...0.6.1)
591
+
592
+ - Fixes bug with promise code and saving event firing, where promises are not properly resolved with ".all" during saving events.
593
+
594
+ **0.6.0** — <small>_November 25, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.8...0.6.0)
595
+
596
+ - Updating dependency to knex.js 0.5.x.
597
+ - Switched from when.js to [bluebird](https://github.com/petkaantonov/bluebird) for promise implementation, with shim for backward compatibility.
598
+ - Switched from underscore to lodash, for semver reliability.
599
+
600
+ **0.5.8** — <small>_November 24, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.7...0.5.8)
601
+
602
+ - Parse models after all relations have been eager loaded, for appropriate column name matching (thanks [@benesch](https://github.com/benesch)) (#97)
603
+ - Specify table for `withRelated` fetches to prevent column naming conflicts (#96).
604
+ - Fix for polymorphic relation loading (#95).
605
+ - Other documentation tweaks and other internal code cleanup.
606
+
607
+ **0.5.7** — <small>_October 11, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.6...0.5.7)
608
+
609
+ - The "fetching" event is now fired on eager loaded relation fetches.
610
+
611
+ **0.5.6** — <small>_October 10, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.5...0.5.6)
612
+
613
+ - The `options.query` now contains the appropriate `knex` instance during the "fetching" event handler.
614
+
615
+ **0.5.5** — <small>_October 1, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.4...0.5.5)
616
+
617
+ - An eager loaded [morphTo](#Model-morphTo) relation may now have child relations nested beneath it that are properly eager loaded, depending on the parent.
618
+
619
+ **0.5.4** — <small>_October 1, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.3...0.5.4)
620
+
621
+ - Fix issue where the `relatedData` context was not appropriately maintained for subsequent {@link Collection#create} calls after an eager load (#77).
622
+ - Documentation improvements, encouraging the use of {@link Model#related} rather than calling a relation method directly, to keep association with the parent model's {@link Model#relations relations} hash.
623
+
624
+ **0.5.3** — <small>_September 26, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.2...0.5.3)
625
+
626
+ - The `columns` explicitly specified in a fetch are no-longer passed along when eager loading relations, fixes (#70).
627
+
628
+ **0.5.2** — <small>_September 22, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.1...0.5.2)
629
+
630
+ - Fixed incorrect eager loading in `belongsTo` relations (#65).
631
+
632
+ **0.5.1** — <small>_September 21, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.5.0...0.5.1)
633
+
634
+ - Fixed incorrect eager loading in `hasOne` relations (#63).
635
+
636
+ **0.5.0** — <small>_September 20, 2013_</small> — [Diff](https://github.com/bookshelf/bookshelf/compare/0.3.1...0.5.0)
637
+
638
+ #### Major Breaking Changes
639
+
640
+ - Global state is no longer stored in the library, an instance is returned from `Bookshelf.initialize`, so you will need to call this once and then reference this `Bookshelf` client elsewhere in your application.
641
+ - Lowercasing of `bookshelf.initialize`, `bookshelf.knex`, `bookshelf.transaction`.
642
+ - During the lifecycle events, such as "fetching", "saving", or "destroying", the model no-longer contains the active query builder instance at the time it is saved. If you need to modify the query builder chain inside of an event handler, you may now use `options.query` inside the event handlers.
643
+
644
+ #### Other changes
645
+
646
+ - Added `tableName` for all queries, so joins use the correct id (#61).
647
+ - The `attach` & `detach` now remove models from the associated collection, as appropriate (#59).
648
+ - A `withPivot` no longer accepts an object to specify the keys for the returned pivot items, if you wish to specify how these pivot objects are defined on the object, a custom [toJSON](#Model-toJSON) is your best bet.
649
+ - Added {@link Collection#invokeThen} and {@link Collection#mapThen} as convenience helpers for `Promise.all(collection.invoke(method, args*))` and `Promise.all(collection.map(method, iterator, [context]))`, respectively.
650
+ - Added a `Bookshelf.plugin` method, for a standard way to extend Bookshelf instances.
651
+ - A re-written modular architecture, to move the library toward becoming a database agnostic "data mapper" foundation, with the ablitiy to form relations between different data stores and types, not just SQL (although SQL is the primary focus for now). Also, support for AMD, for eventual use outside of Node.js runtime (with webSQL and likewise).
652
+
653
+ **0.3.1** — <small>_August 29, 2013_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.3.0...0.3.1)
654
+
655
+ - [Docs](http://htmlpreview.github.com/?https://raw.github.com/bookshelf/bookshelf/0.3.0/index.html)
656
+ - Fixed regression in `belongsToMany` custom column name order.
657
+
658
+ **0.3.0** — <small>_August 28, 2013_</small>
659
+
660
+ - Support for a {@link Model#through} clause on various model relations.
661
+ - Creating a model from a related collection maintains the appropriate relation data (#35).
662
+ - Support for a `{patch: true}` flag on save, to only update specific saved attributes.
663
+ - Added a `fetchOne` method, for pulling out a single model from a collection, mostly useful for related collection instances.
664
+ - Updated to Knex "0.2.x" syntax for insert / returning.
665
+ - Ability to specify a `morphValue` on {@link Model#morphOne} or {@link Model#morphMany} relations.
666
+ - Internal refactor of relations for more consistent behavior.
667
+
668
+ **0.2.8** — <small>_August 26, 2013_</small>
669
+
670
+ - Some minor fixes to make the `Sync` methods more consistent in their behavior when called directly, (#53).
671
+
672
+ **0.2.7** — <small>_August 21, 2013_</small>
673
+
674
+ - Timestamp for `created_at` is not set during an "update" query, and the update where clause does not include the `idAttribute` if it isn't present (#51).
675
+
676
+ **0.2.6** — <small>_August 21, 2013_</small>
677
+
678
+ - Fixes bug with query function feature added in `0.2.5`, mentioned in (#51).
679
+
680
+ **0.2.5** — <small>_August 19, 2013_</small>
681
+
682
+ - The {@link Model#query} method may now accept a function, for even more dynamic query building (#45).
683
+ - Fix for relations not allowing `0` as a valid foreign key value (#49).
684
+
685
+ **0.2.4** — <small>_July 30, 2013_</small>
686
+
687
+ - More consistent query resetting, fixing query issues on post-query event handlers.
688
+ - The `toJSON` is only called on a related model if the method exists, allowing for objects or arrays to be manually specified on the `relations` hash and serialized properly on the parent's `toJSON`.
689
+
690
+ **0.2.3** — <small>_July 7, 2013_</small>
691
+
692
+ - Fixing bug where `triggerThen` wasn't actually being used for several of the events as noted in 0.2.1 release.
693
+
694
+ **0.2.2** — <small>_July 2, 2013_</small>
695
+
696
+ - The Model's `related` method is now a no-op if the model doesn't have the related method.
697
+ - Any `withPivot` columns on many-to-many relations are now prefixed with `_pivot` rather than `pivot` unless named otherwise, for consistency.
698
+ - The `_reset` is not called until after all triggered events so that `hasChanged` can be used on the current model state in the "created", "updated", "saved", and "destroyed" events.
699
+ - Eager queries may be specified as an object with a function, to constrain the eager queries:
700
+
701
+
702
+ user.fetch({withRelated: ['accounts', {
703
+ 'accounts.settings': function(qb) { qb.where('status', 'enabled'); }
704
+ }, 'other_data']}).then(...
705
+
706
+ **0.2.1** — <small>_June 26, 2013_</small>
707
+
708
+ - Using `triggerThen` instead of `trigger` for "created", "updated", "saved", "destroyed", and "fetched" events - if any async operations are needed _after_ the model is created but before resolving the original promise.
709
+
710
+ **0.2.0** — <small>_June 24, 2013_</small>
711
+
712
+ - Resolve Model's `fetch` promise with `null` rather than `undefined`.
713
+ - An object of `query` constraints (e.g. `{where: {...}, orWhere: {...}}`may be passed to the query method (#30).
714
+ - Fix for empty eager relation responses not providing an empty model or collection instance on the `model.relations` object.
715
+
716
+ **0.1.9** — <small>_June 19, 2013_</small>
717
+
718
+ - Resolve Model's `fetch` promise with `undefined` if no model was returned.
719
+ - An array of "created at" and "updated at" values may be used for `hasTimestamps`.
720
+ - Format is called on the `Model#fetch` method.
721
+ - Added an `exec` plugin to provide a node callback style interface for any of the promise methods.
722
+
723
+ **0.1.8** — <small>_June 18, 2013_</small>
724
+
725
+ - Added support for polymorphic associations, with `morphOne`, `morphMany`, and `morphTo` model methods.
726
+
727
+ **0.1.7** — <small>_June 15, 2013_</small>
728
+
729
+ - Bugfix where `detach` may be used with no parameters to detach all related items (#19).
730
+
731
+ **0.1.6** — <small>_June 15, 2013_</small>
732
+
733
+ - Fixing bug allowing custom `idAttribute` values to be used in eager loaded many-to-many relations (#18).
734
+
735
+ **0.1.5** — <small>_June 11, 2013_</small>
736
+
737
+ - Ensuring each of the `_previousAttribute` and `changed` values are properly reset on related models after sync actions.
738
+
739
+ **0.1.4** — <small>_June 10, 2013_</small>
740
+
741
+ - Fixing issue with `idAttribute` not being assigned after database inserts.
742
+ - Removing various aliases {@link Events} methods for clarity.
743
+
744
+ **0.1.3** — <small>_June 10, 2013_</small>
745
+
746
+ - Added {@link Model#hasChanged}, {@link Model#previous}, and {@link Model#previousAttributes} methods, for getting the previous value of the model since the last sync.
747
+ - Using `Object.create(null)` for various internal model objects dealing with user values.
748
+ - Calling {@link Model#related} on a model will now create an empty related object if one is not present on the `relations` object.
749
+ - Removed the `{patch: true}` option on save, instead only applying defaults if the object `isNew`, or if `{defaults: true}` is passed.
750
+ - Fix for `model.clone`'s relation responses.
751
+
752
+ **0.1.2** — <small>_May 17, 2013_</small>
753
+
754
+ - Added `triggerThen` and `emitThen` for promise based events, used internally in the "creating", "updating", "saving", and "destroying" events.
755
+ - Docs updates, fixing `{patch: true}` on `update` to have intended functionality.
756
+ - A model's `toJSON` is now correctly called on any related properties.
757
+
758
+ **0.1.1** — <small>_May 16, 2013_</small>
759
+
760
+ - Fixed bug with eager loaded `belongsTo` relations (#14).
761
+
762
+ **0.1.0** — <small>_May 13, 2013_</small>
763
+
764
+ - Initial Bookshelf release.