leoric 2.5.0 → 2.6.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/package.json +1 -1
- package/src/constants.js +5 -2
- package/src/data_types.js +7 -32
- package/src/drivers/abstract/spellbook.js +12 -10
- package/src/drivers/mysql/index.js +3 -2
- package/src/drivers/postgres/index.js +3 -2
- package/src/drivers/sqlite/index.js +3 -2
- package/src/expr_formatter.js +27 -1
- package/src/realm.js +4 -0
- package/types/index.d.ts +16 -5
- package/History.md +0 -716
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -8,6 +8,8 @@ const AGGREGATOR_MAP = {
|
|
|
8
8
|
sum: 'sum'
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
const AGGREGATORS = Object.values(AGGREGATOR_MAP);
|
|
12
|
+
|
|
11
13
|
const LEGACY_TIMESTAMP_MAP = {
|
|
12
14
|
gmtCreate: 'createdAt',
|
|
13
15
|
gmtModified: 'updatedAt',
|
|
@@ -20,7 +22,7 @@ const LEGACY_TIMESTAMP_COLUMN_MAP = {
|
|
|
20
22
|
deleted_at: 'gmt_deleted',
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
const TIMESTAMP_ATTRIBUTE_NAMES = [
|
|
25
|
+
const TIMESTAMP_ATTRIBUTE_NAMES = [
|
|
24
26
|
'createdAt', 'updatedAt', 'deletedAt',
|
|
25
27
|
'gmtCreate', 'gmtModified', 'gmtDeleted',
|
|
26
28
|
'created_at', 'updated_at', 'deleted_at',
|
|
@@ -40,5 +42,6 @@ module.exports = {
|
|
|
40
42
|
TIMESTAMP_NAMES,
|
|
41
43
|
LEGACY_TIMESTAMP_COLUMN_MAP,
|
|
42
44
|
ASSOCIATE_METADATA_MAP,
|
|
43
|
-
TIMESTAMP_ATTRIBUTE_NAMES
|
|
45
|
+
TIMESTAMP_ATTRIBUTE_NAMES,
|
|
46
|
+
AGGREGATORS,
|
|
44
47
|
};
|
package/src/data_types.js
CHANGED
|
@@ -312,8 +312,7 @@ class DECIMAL extends INTEGER {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
const rDateFormat = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:[,.]\d{3,6})$/;
|
|
316
|
-
|
|
315
|
+
const rDateFormat = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:[,.]\d{3,6}){0,1}$/;
|
|
317
316
|
class DATE extends DataType {
|
|
318
317
|
constructor(precision, timezone = true) {
|
|
319
318
|
super();
|
|
@@ -359,7 +358,9 @@ class DATE extends DataType {
|
|
|
359
358
|
// @deprecated
|
|
360
359
|
// vaguely standard date formats such as 2021-10-15 15:50:02,548
|
|
361
360
|
if (typeof value === 'string' && rDateFormat.test(value)) {
|
|
362
|
-
|
|
361
|
+
// 2021-10-15 15:50:02,548 => 2021-10-15T15:50:02,548,
|
|
362
|
+
// 2021-10-15 15:50:02 => 2021-10-15T15:50:02.000
|
|
363
|
+
value = new Date(`${value.replace(' ', 'T').replace(',', '.')}`);
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
// 1634611135776
|
|
@@ -371,10 +372,12 @@ class DATE extends DataType {
|
|
|
371
372
|
}
|
|
372
373
|
}
|
|
373
374
|
|
|
374
|
-
class DATEONLY extends
|
|
375
|
+
class DATEONLY extends DATE {
|
|
375
376
|
constructor() {
|
|
376
377
|
super();
|
|
377
378
|
this.dataType = 'date';
|
|
379
|
+
this.precision = null;
|
|
380
|
+
this.timezone = false;
|
|
378
381
|
}
|
|
379
382
|
|
|
380
383
|
toSqlString() {
|
|
@@ -387,34 +390,6 @@ class DATEONLY extends DataType {
|
|
|
387
390
|
}
|
|
388
391
|
return value;
|
|
389
392
|
}
|
|
390
|
-
|
|
391
|
-
cast(value) {
|
|
392
|
-
const original = value;
|
|
393
|
-
if (value == null) return value;
|
|
394
|
-
if (!(value instanceof Date)) value = new Date(value);
|
|
395
|
-
if (isNaN(value.getTime())) return original;
|
|
396
|
-
return this._round(value);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
uncast(value) {
|
|
400
|
-
const originValue = value;
|
|
401
|
-
|
|
402
|
-
if (value == null || value instanceof Raw) return value;
|
|
403
|
-
if (typeof value.toDate === 'function') {
|
|
404
|
-
value = value.toDate();
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// @deprecated
|
|
408
|
-
// vaguely standard date formats such as 2021-10-15 15:50:02,548
|
|
409
|
-
if (typeof value === 'string' && rDateFormat.test(value)) {
|
|
410
|
-
value = new Date(`${value.replace(' ', 'T').replace(',', '.')}Z`);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
if (!(value instanceof Date)) value = new Date(value);
|
|
414
|
-
if (isNaN(value)) throw new Error(util.format('invalid date: %s', originValue));
|
|
415
|
-
|
|
416
|
-
return this._round(value);
|
|
417
|
-
}
|
|
418
393
|
}
|
|
419
394
|
|
|
420
395
|
class BOOLEAN extends DataType {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const SqlString = require('sqlstring');
|
|
4
4
|
|
|
5
5
|
const { copyExpr, findExpr, walkExpr } = require('../../expr');
|
|
6
|
-
const { formatExpr, formatConditions, collectLiteral } = require('../../expr_formatter');
|
|
6
|
+
const { formatExpr, formatConditions, collectLiteral, isAggregatorExpr } = require('../../expr_formatter');
|
|
7
7
|
const Raw = require('../../raw');
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -91,10 +91,12 @@ function formatSelectExpr(spell, values) {
|
|
|
91
91
|
const baseName = Model.tableAlias;
|
|
92
92
|
const selects = new Set();
|
|
93
93
|
const map = {};
|
|
94
|
+
let isAggregate = false;
|
|
94
95
|
|
|
95
96
|
for (const token of columns) {
|
|
96
97
|
collectLiteral(spell, token, values);
|
|
97
98
|
const selectExpr = formatExpr(spell, token);
|
|
99
|
+
isAggregate = isAggregate || isAggregatorExpr(spell, token);
|
|
98
100
|
const qualifier = token.qualifiers ? token.qualifiers[0] : '';
|
|
99
101
|
const list = map[qualifier] || (map[qualifier] = []);
|
|
100
102
|
list.push(selectExpr);
|
|
@@ -104,7 +106,7 @@ function formatSelectExpr(spell, values) {
|
|
|
104
106
|
const list = map[qualifier];
|
|
105
107
|
if (list) {
|
|
106
108
|
for (const selectExpr of list) selects.add(selectExpr);
|
|
107
|
-
} else if (groups.length === 0 && Model.driver.type !== 'sqlite') {
|
|
109
|
+
} else if (groups.length === 0 && Model.driver.type !== 'sqlite' && !isAggregate) {
|
|
108
110
|
selects.add(`${escapeId(qualifier)}.*`);
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -163,7 +165,7 @@ class SpellBook {
|
|
|
163
165
|
const { escapeId } = Model.driver;
|
|
164
166
|
let columns = [];
|
|
165
167
|
let updateOnDuplicateColumns = [];
|
|
166
|
-
|
|
168
|
+
|
|
167
169
|
let values = [];
|
|
168
170
|
let placeholders = [];
|
|
169
171
|
if (Array.isArray(sets)) {
|
|
@@ -181,14 +183,14 @@ class SpellBook {
|
|
|
181
183
|
columnAttributes.push(Model.columnAttributes[name]);
|
|
182
184
|
}
|
|
183
185
|
}
|
|
184
|
-
|
|
186
|
+
|
|
185
187
|
for (const entry of columnAttributes) {
|
|
186
188
|
columns.push(entry.columnName);
|
|
187
|
-
if (updateOnDuplicate && createdAt && entry.name === createdAt
|
|
189
|
+
if (updateOnDuplicate && createdAt && entry.name === createdAt
|
|
188
190
|
&& !(Array.isArray(updateOnDuplicate) && updateOnDuplicate.includes(createdAt))) continue;
|
|
189
191
|
updateOnDuplicateColumns.push(entry.columnName);
|
|
190
192
|
}
|
|
191
|
-
|
|
193
|
+
|
|
192
194
|
for (const entry of sets) {
|
|
193
195
|
if (shardingKey && entry[shardingKey] == null) {
|
|
194
196
|
throw new Error(`Sharding key ${Model.table}.${shardingKey} cannot be NULL.`);
|
|
@@ -199,7 +201,7 @@ class SpellBook {
|
|
|
199
201
|
}
|
|
200
202
|
placeholders.push(`(${new Array(columnAttributes.length).fill('?').join(',')})`);
|
|
201
203
|
}
|
|
202
|
-
|
|
204
|
+
|
|
203
205
|
} else {
|
|
204
206
|
if (shardingKey && sets[shardingKey] == null) {
|
|
205
207
|
throw new Error(`Sharding key ${Model.table}.${shardingKey} cannot be NULL.`);
|
|
@@ -216,10 +218,10 @@ class SpellBook {
|
|
|
216
218
|
updateOnDuplicateColumns.push(Model.unalias(name));
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
|
|
222
|
+
|
|
221
223
|
const chunks = ['INSERT'];
|
|
222
|
-
|
|
224
|
+
|
|
223
225
|
// see https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html
|
|
224
226
|
const hintStr = this.formatOptimizerHints(spell);
|
|
225
227
|
if (hintStr) {
|
|
@@ -94,20 +94,21 @@ class MysqlDriver extends AbstractDriver {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
const sql = logger.format(query, values, opts);
|
|
97
|
+
const logOpts = { ...opts, query };
|
|
97
98
|
const start = performance.now();
|
|
98
99
|
let result;
|
|
99
100
|
|
|
100
101
|
try {
|
|
101
102
|
result = await promise;
|
|
102
103
|
} catch (err) {
|
|
103
|
-
logger.logQueryError(err, sql, calculateDuration(start),
|
|
104
|
+
logger.logQueryError(err, sql, calculateDuration(start), logOpts);
|
|
104
105
|
throw err;
|
|
105
106
|
} finally {
|
|
106
107
|
if (!opts.connection) connection.release();
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
const [ results, fields ] = result;
|
|
110
|
-
logger.tryLogQuery(sql, calculateDuration(start),
|
|
111
|
+
logger.tryLogQuery(sql, calculateDuration(start), logOpts, results);
|
|
111
112
|
if (fields) return { rows: results, fields };
|
|
112
113
|
return results;
|
|
113
114
|
}
|
|
@@ -51,6 +51,7 @@ class PostgresDriver extends AbstractDriver {
|
|
|
51
51
|
const command = sql.slice(0, sql.indexOf(' ')).toLowerCase();
|
|
52
52
|
|
|
53
53
|
async function tryQuery(...args) {
|
|
54
|
+
const logOpts = { ...spell, query: sql };
|
|
54
55
|
const formatted = logger.format(sql, values, spell);
|
|
55
56
|
const start = performance.now();
|
|
56
57
|
let result;
|
|
@@ -58,13 +59,13 @@ class PostgresDriver extends AbstractDriver {
|
|
|
58
59
|
try {
|
|
59
60
|
result = await connection.query(...args);
|
|
60
61
|
} catch (err) {
|
|
61
|
-
logger.logQueryError(err, formatted, calculateDuration(start),
|
|
62
|
+
logger.logQueryError(err, formatted, calculateDuration(start), logOpts);
|
|
62
63
|
throw err;
|
|
63
64
|
} finally {
|
|
64
65
|
if (!spell.connection) connection.release();
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
logger.tryLogQuery(formatted, calculateDuration(start),
|
|
68
|
+
logger.tryLogQuery(formatted, calculateDuration(start), logOpts, result);
|
|
68
69
|
return result;
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -53,6 +53,7 @@ class SqliteDriver extends AbstractDriver {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const { logger } = this;
|
|
56
|
+
const logOpts = { ...opts, query };
|
|
56
57
|
const sql = logger.format(query, values, opts);
|
|
57
58
|
const start = performance.now();
|
|
58
59
|
let result;
|
|
@@ -60,13 +61,13 @@ class SqliteDriver extends AbstractDriver {
|
|
|
60
61
|
try {
|
|
61
62
|
result = await connection.query(query, values, opts);
|
|
62
63
|
} catch (err) {
|
|
63
|
-
logger.logQueryError(err, sql, calculateDuration(start),
|
|
64
|
+
logger.logQueryError(err, sql, calculateDuration(start), logOpts);
|
|
64
65
|
throw err;
|
|
65
66
|
} finally {
|
|
66
67
|
if (!opts.connection) connection.release();
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
logger.tryLogQuery(sql, calculateDuration(start),
|
|
70
|
+
logger.tryLogQuery(sql, calculateDuration(start), logOpts, result);
|
|
70
71
|
return result;
|
|
71
72
|
}
|
|
72
73
|
|
package/src/expr_formatter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { precedes, walkExpr } = require('./expr');
|
|
4
|
+
const { AGGREGATORS } = require('./constants');
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Find model by qualifiers.
|
|
@@ -65,6 +66,31 @@ function formatLiteral(spell, ast) {
|
|
|
65
66
|
return '?';
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Format the abstract syntax tree of an expression into escaped string.
|
|
71
|
+
* @param {Spell} spell
|
|
72
|
+
* @param {Object} ast
|
|
73
|
+
*/
|
|
74
|
+
function isAggregatorExpr(spell, ast) {
|
|
75
|
+
const { type, name, args } = ast;
|
|
76
|
+
switch (type) {
|
|
77
|
+
case 'literal':
|
|
78
|
+
case 'subquery':
|
|
79
|
+
case 'wildcard':
|
|
80
|
+
case 'mod':
|
|
81
|
+
case 'id':
|
|
82
|
+
case 'raw':
|
|
83
|
+
case 'op':
|
|
84
|
+
return false;
|
|
85
|
+
case 'alias':
|
|
86
|
+
return isAggregatorExpr(spell, args[0]);
|
|
87
|
+
case 'func':
|
|
88
|
+
return AGGREGATORS.includes(name);
|
|
89
|
+
default:
|
|
90
|
+
throw new Error(`Unexpected type ${type}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
68
94
|
/**
|
|
69
95
|
* Format the abstract syntax tree of an expression into escaped string.
|
|
70
96
|
* @param {Spell} spell
|
|
@@ -216,4 +242,4 @@ function coerceLiteral(spell, ast) {
|
|
|
216
242
|
}
|
|
217
243
|
}
|
|
218
244
|
|
|
219
|
-
module.exports = { formatExpr, formatConditions, collectLiteral };
|
|
245
|
+
module.exports = { formatExpr, formatConditions, collectLiteral, isAggregatorExpr };
|
package/src/realm.js
CHANGED
|
@@ -75,6 +75,10 @@ async function loadModels(Spine, models, opts) {
|
|
|
75
75
|
const schemaInfo = await Spine.driver.querySchemaInfo(database, tables);
|
|
76
76
|
|
|
77
77
|
for (const model of models) {
|
|
78
|
+
// assign driver if model's driver not exist
|
|
79
|
+
if (!model.driver) model.driver = Spine.driver;
|
|
80
|
+
// assign options if model's options not exist
|
|
81
|
+
if (!model.options) model.options = Spine.options;
|
|
78
82
|
const columns = schemaInfo[model.physicTable] || schemaInfo[model.table];
|
|
79
83
|
if (!model.attributes) initAttributes(model, columns);
|
|
80
84
|
model.load(columns);
|
package/types/index.d.ts
CHANGED
|
@@ -205,6 +205,11 @@ interface QueryOptions {
|
|
|
205
205
|
hooks?: boolean;
|
|
206
206
|
paranoid?: boolean;
|
|
207
207
|
silent?: boolean;
|
|
208
|
+
connection?: Connection;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface TransactionOptions {
|
|
212
|
+
connection: Connection;
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
interface QueryResult {
|
|
@@ -214,7 +219,7 @@ interface QueryResult {
|
|
|
214
219
|
fields?: Array<{ table: string, name: string }>,
|
|
215
220
|
}
|
|
216
221
|
|
|
217
|
-
interface Connection {
|
|
222
|
+
export interface Connection {
|
|
218
223
|
/**
|
|
219
224
|
* MySQL
|
|
220
225
|
*/
|
|
@@ -322,10 +327,10 @@ declare class AbstractDriver {
|
|
|
322
327
|
* @param callback
|
|
323
328
|
*/
|
|
324
329
|
disconnect(callback?: Function): Promise<boolean | void>;
|
|
325
|
-
|
|
330
|
+
|
|
326
331
|
/**
|
|
327
332
|
* query with spell
|
|
328
|
-
* @param spell
|
|
333
|
+
* @param spell
|
|
329
334
|
*/
|
|
330
335
|
cast(spell: Spell<typeof Bone, ResultSet | number | null>): Promise<QueryResult>;
|
|
331
336
|
|
|
@@ -424,7 +429,7 @@ declare class AbstractDriver {
|
|
|
424
429
|
* remove index in table
|
|
425
430
|
* @param table string
|
|
426
431
|
* @param attributes attributes name
|
|
427
|
-
* @param opts
|
|
432
|
+
* @param opts
|
|
428
433
|
*/
|
|
429
434
|
removeIndex(table: string, attributes: string[], opts?: { unique?: boolean, type?: string }): Promise<void>;
|
|
430
435
|
|
|
@@ -695,7 +700,7 @@ export class Bone {
|
|
|
695
700
|
* });
|
|
696
701
|
*/
|
|
697
702
|
static transaction(callback: GeneratorFunction): Promise<RawQueryResult>;
|
|
698
|
-
static transaction(callback: (connection:
|
|
703
|
+
static transaction(callback: (connection: TransactionOptions) => Promise<RawQueryResult | void>): Promise<RawQueryResult>;
|
|
699
704
|
|
|
700
705
|
/**
|
|
701
706
|
* DROP the table
|
|
@@ -881,6 +886,12 @@ export default class Realm {
|
|
|
881
886
|
|
|
882
887
|
connect(): Promise<Bone>;
|
|
883
888
|
|
|
889
|
+
/**
|
|
890
|
+
* disconnect manually
|
|
891
|
+
* @param callback
|
|
892
|
+
*/
|
|
893
|
+
disconnect(callback?: Function): Promise<boolean | void>;
|
|
894
|
+
|
|
884
895
|
define(
|
|
885
896
|
name: string,
|
|
886
897
|
attributes: Record<string, DataTypes<DataType> | AttributeMeta>,
|
package/History.md
DELETED
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
2.5.0 / 2022-05-13
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
## What's Changed
|
|
5
|
-
* feat: support disconnect and fix timestamps init by @JimmyDaddy in https://github.com/cyjake/leoric/pull/313
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.4.1...v2.5.0
|
|
9
|
-
|
|
10
|
-
2.4.1 / 2022-04-27
|
|
11
|
-
==================
|
|
12
|
-
|
|
13
|
-
## What's Changed
|
|
14
|
-
* fix: realm.Bone.DataTypes should be invokable, Invokable.TYPE.toSqlString() get wrong default length(1), DataType definitions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/307
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.4.0...v2.4.1
|
|
18
|
-
|
|
19
|
-
2.4.0 / 2022-04-24
|
|
20
|
-
==================
|
|
21
|
-
|
|
22
|
-
## What's Changed
|
|
23
|
-
* feat: support custom driver by @JimmyDaddy in https://github.com/cyjake/leoric/pull/304
|
|
24
|
-
* chore: update build status badge by @snapre in https://github.com/cyjake/leoric/pull/305
|
|
25
|
-
* feat: export more ts type definitions and use deep-equal module by @JimmyDaddy in https://github.com/cyjake/leoric/pull/306
|
|
26
|
-
|
|
27
|
-
## New Contributors
|
|
28
|
-
* @snapre made their first contribution in https://github.com/cyjake/leoric/pull/305
|
|
29
|
-
|
|
30
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.2...v2.4.0
|
|
31
|
-
|
|
32
|
-
2.3.2 / 2022-04-15
|
|
33
|
-
==================
|
|
34
|
-
|
|
35
|
-
## What's Changed
|
|
36
|
-
* fix: order by raw with mix-type array in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/298
|
|
37
|
-
* docs: monthly updates and example about egg-orm usage with TypeScript by @cyjake in https://github.com/cyjake/leoric/pull/299
|
|
38
|
-
* docs: monthly updates in en & docmentation about typescript support by @cyjake in https://github.com/cyjake/leoric/pull/300
|
|
39
|
-
* fix: raw query should format replacements with extra blank by @JimmyDaddy in https://github.com/cyjake/leoric/pull/301
|
|
40
|
-
* docs: elaborate on querying by @cyjake in https://github.com/cyjake/leoric/pull/302
|
|
41
|
-
* feat: transaction should return result by @JimmyDaddy in https://github.com/cyjake/leoric/pull/303
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.1...v2.3.2
|
|
45
|
-
|
|
46
|
-
2.3.1 / 2022-03-22
|
|
47
|
-
==================
|
|
48
|
-
|
|
49
|
-
## What's Changed
|
|
50
|
-
* fix: mysql2 Invalid Date compatible by @JimmyDaddy in https://github.com/cyjake/leoric/pull/291
|
|
51
|
-
* fix: order by raw in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/292
|
|
52
|
-
* fix: bulk update query conditions duplicated in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/293
|
|
53
|
-
* fix: bulk destroy query conditions duplicated in sequelize mode by @JimmyDaddy in https://github.com/cyjake/leoric/pull/295
|
|
54
|
-
* fix: drop column if not defined in attributes when alter table by @cyjake in https://github.com/cyjake/leoric/pull/296
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.3.0...v2.3.1
|
|
58
|
-
|
|
59
|
-
2.3.0 / 2022-03-10
|
|
60
|
-
==================
|
|
61
|
-
|
|
62
|
-
## What's Changed
|
|
63
|
-
* feat: model declaration with decorators by @cyjake in https://github.com/cyjake/leoric/pull/287
|
|
64
|
-
* feat: add VIRTUAL data type by @JimmyDaddy in https://github.com/cyjake/leoric/pull/289
|
|
65
|
-
* fix: create instance dirty check rule fix by @JimmyDaddy in https://github.com/cyjake/leoric/pull/290
|
|
66
|
-
|
|
67
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.3...v2.3.0
|
|
68
|
-
2.2.3 / 2022-03-01
|
|
69
|
-
==================
|
|
70
|
-
|
|
71
|
-
## What's Changed
|
|
72
|
-
* fix: normalize attribute defaultValue by @cyjake in https://github.com/cyjake/leoric/pull/285
|
|
73
|
-
* fix: instance beforeUpdate hooks should not modify any Raw if there are no Raw assignment in them by @JimmyDaddy in https://github.com/cyjake/leoric/pull/283
|
|
74
|
-
|
|
75
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.2...v2.2.3
|
|
76
|
-
|
|
77
|
-
2.2.2 / 2022-02-28
|
|
78
|
-
==================
|
|
79
|
-
|
|
80
|
-
## What's Changed
|
|
81
|
-
* fix: tddl gives misleading information_schema.columns.table_name by @cyjake in https://github.com/cyjake/leoric/pull/284
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.1...v2.2.2
|
|
85
|
-
|
|
86
|
-
2.2.1 / 2022-02-24
|
|
87
|
-
==================
|
|
88
|
-
|
|
89
|
-
## What's Changed
|
|
90
|
-
* fix: realm.DataTypes should be invokable by @cyjake in https://github.com/cyjake/leoric/pull/282
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.2.0...v2.2.1
|
|
94
|
-
|
|
95
|
-
2.2.0 / 2022-02-24
|
|
96
|
-
==================
|
|
97
|
-
|
|
98
|
-
## What's Changed
|
|
99
|
-
* fix: add missing `password` field for `ConnectOptions` by @luckydrq in https://github.com/cyjake/leoric/pull/280
|
|
100
|
-
* feat: integer types (mostly mysql specific) by @cyjake in https://github.com/cyjake/leoric/pull/281
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.1.1...v2.2.0
|
|
104
|
-
|
|
105
|
-
2.1.1 / 2022-02-23
|
|
106
|
-
==================
|
|
107
|
-
|
|
108
|
-
## What's Changed
|
|
109
|
-
* fix: fix #274 update with fields option by @JimmyDaddy in https://github.com/cyjake/leoric/pull/275
|
|
110
|
-
* fix: upsert should set createdAt by default while createdAt not set by @JimmyDaddy in https://github.com/cyjake/leoric/pull/277
|
|
111
|
-
* fix: previousChanges should check instance is new record or not while specific attributes' values were undefined by @JimmyDaddy in https://github.com/cyjake/leoric/pull/276
|
|
112
|
-
* docs: add types for realm by @luckydrq in https://github.com/cyjake/leoric/pull/278
|
|
113
|
-
|
|
114
|
-
## New Contributors
|
|
115
|
-
* @luckydrq made their first contribution in https://github.com/cyjake/leoric/pull/278
|
|
116
|
-
|
|
117
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.1.0...v2.1.1
|
|
118
|
-
|
|
119
|
-
2.1.0 / 2022-02-17
|
|
120
|
-
==================
|
|
121
|
-
|
|
122
|
-
## What's Changed
|
|
123
|
-
* feat: fix #270 sequelize mode bulkBuild by @JimmyDaddy in https://github.com/cyjake/leoric/pull/273
|
|
124
|
-
* fix: mysql delete/remove/destroy with limit and orders by @JimmyDaddy in https://github.com/cyjake/leoric/pull/272
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.4...v2.1.0
|
|
128
|
-
|
|
129
|
-
2.0.4 / 2022-02-16
|
|
130
|
-
==================
|
|
131
|
-
|
|
132
|
-
## What's Changed
|
|
133
|
-
* fix: fix unit test error by @LB4027221 in https://github.com/cyjake/leoric/pull/269
|
|
134
|
-
* fix: attribute.defaultValue should be set when init attributes by @cyjake in https://github.com/cyjake/leoric/pull/271
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.3...v2.0.4
|
|
138
|
-
|
|
139
|
-
2.0.3 / 2022-02-11
|
|
140
|
-
==================
|
|
141
|
-
|
|
142
|
-
## What's Changed
|
|
143
|
-
* fix: default updatedAt to new date if model has no createdAt by @LB4027221 in https://github.com/cyjake/leoric/pull/268
|
|
144
|
-
|
|
145
|
-
## New Contributors
|
|
146
|
-
* @LB4027221 made their first contribution in https://github.com/cyjake/leoric/pull/268
|
|
147
|
-
|
|
148
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.2...v2.0.3
|
|
149
|
-
|
|
150
|
-
2.0.2 / 2022-02-10
|
|
151
|
-
==================
|
|
152
|
-
|
|
153
|
-
## What's Changed
|
|
154
|
-
* fix: order by alias should not throw by @cyjake in https://github.com/cyjake/leoric/pull/255
|
|
155
|
-
* fix: fix #257 DataType.uncast should skip Raw type at type checking by @JimmyDaddy in https://github.com/cyjake/leoric/pull/258
|
|
156
|
-
* docs: async function in transaction by @cyjake in https://github.com/cyjake/leoric/pull/259
|
|
157
|
-
* fix: fixed #256 static create instance should check all default attri… by @JimmyDaddy in https://github.com/cyjake/leoric/pull/262
|
|
158
|
-
* fix: fix #260 UPDATE with LIMIT and ORDER should be formatted(mysql only) by @JimmyDaddy in https://github.com/cyjake/leoric/pull/261
|
|
159
|
-
* refactor: keep the UPDATE ... ORDER BY ... LIMIT to mysql driver by @cyjake in https://github.com/cyjake/leoric/pull/264
|
|
160
|
-
* fix: fix #263 upsert attributes should use defaultValue while there i… by @JimmyDaddy in https://github.com/cyjake/leoric/pull/265
|
|
161
|
-
* fix: fix restore Error `Undefined attribute "deletedAt"` by @JimmyDaddy in https://github.com/cyjake/leoric/pull/267
|
|
162
|
-
* fix: type checking adaption by @JimmyDaddy in https://github.com/cyjake/leoric/pull/266
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v2.0.1...v2.0.2
|
|
166
|
-
|
|
167
|
-
2.0.1 / 2022-01-05
|
|
168
|
-
==================
|
|
169
|
-
|
|
170
|
-
## What's Changed
|
|
171
|
-
* fix: format numeric result by @JimmyDaddy in https://github.com/cyjake/leoric/pull/253
|
|
172
|
-
* fix: should still return number if value is '0.000' by @cyjake in https://github.com/cyjake/leoric/pull/254
|
|
173
|
-
|
|
174
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.1...v2.0.1
|
|
175
|
-
|
|
176
|
-
2.0.0 / 2021-12-28
|
|
177
|
-
==================
|
|
178
|
-
|
|
179
|
-
## What's Changed
|
|
180
|
-
* breaking: model.sync add force/alter option by @SmartOrange in https://github.com/cyjake/leoric/pull/224
|
|
181
|
-
* breaking: logQueryError(err, sql, duration, options) by @cyjake in https://github.com/cyjake/leoric/pull/237
|
|
182
|
-
* test: add utf8mb4 test cases by @fengmk2 in https://github.com/cyjake/leoric/pull/239
|
|
183
|
-
* Merge 1.x changes by @cyjake in https://github.com/cyjake/leoric/pull/249
|
|
184
|
-
|
|
185
|
-
## New Contributors
|
|
186
|
-
* @SmartOrange made their first contribution in https://github.com/cyjake/leoric/pull/222
|
|
187
|
-
|
|
188
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.1...v2.0.0
|
|
189
|
-
|
|
190
|
-
1.15.1 / 2021-12-28
|
|
191
|
-
===================
|
|
192
|
-
|
|
193
|
-
## What's Changed
|
|
194
|
-
* fix: fix #242 date string format by @JimmyDaddy in https://github.com/cyjake/leoric/pull/243
|
|
195
|
-
* fix: update with empty conditions by @JimmyDaddy in https://github.com/cyjake/leoric/pull/241
|
|
196
|
-
* fix: silent option's priority should be lower than valueSet by @JimmyDaddy in https://github.com/cyjake/leoric/pull/244
|
|
197
|
-
* fix: information_schema.columns.datetime_precision by @cyjake in https://github.com/cyjake/leoric/pull/246
|
|
198
|
-
* fix: should not hoist subquery if query is ordered by external columns by @cyjake in https://github.com/cyjake/leoric/pull/247
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.15.0...v1.15.1
|
|
202
|
-
|
|
203
|
-
1.15.0 / 2021-11-22
|
|
204
|
-
===================
|
|
205
|
-
|
|
206
|
-
## What's Changed
|
|
207
|
-
* feat: make duration in precise milliseconds by @fengmk2 in https://github.com/cyjake/leoric/pull/236
|
|
208
|
-
* fix: spell.increment() & spell.decrement() @cyjake https://github.com/cyjake/leoric/pull/234
|
|
209
|
-
* fix: bulkCreate should adapte empty data @JimmyDaddy https://github.com/cyjake/leoric/pull/232
|
|
210
|
-
|
|
211
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.4...v1.14.5
|
|
212
|
-
|
|
213
|
-
1.14.4 / 2021-11-15
|
|
214
|
-
===================
|
|
215
|
-
|
|
216
|
-
## What's Changed
|
|
217
|
-
|
|
218
|
-
* test: PostgreSQL v14 test case compatibility by @cyjake https://github.com/cyjake/leoric/pull/230
|
|
219
|
-
* fix: turn off subquery optimization if query criteria contains other column by @cyjake https://github.com/cyjake/leoric/pull/229
|
|
220
|
-
* fix: bone.changed() return `false | string[]` type by @fengmk2 https://github.com/cyjake/leoric/pull/231
|
|
221
|
-
|
|
222
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.3...v1.14.4
|
|
223
|
-
|
|
224
|
-
1.14.3 / 2021-11-12
|
|
225
|
-
===================
|
|
226
|
-
|
|
227
|
-
## What's Changed
|
|
228
|
-
* fix: logger.logQuery should be guarded in case of error by @SmartOrange in https://github.com/cyjake/leoric/pull/222
|
|
229
|
-
* fix: findOne without result should return null by @JimmyDaddy in https://github.com/cyjake/leoric/pull/225
|
|
230
|
-
* fix: Literal should support bigint type by @fengmk2 in https://github.com/cyjake/leoric/pull/226
|
|
231
|
-
* fix: select((name: string) => boolean) by @cyjake in https://github.com/cyjake/leoric/pull/227
|
|
232
|
-
|
|
233
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.2...v1.14.3
|
|
234
|
-
|
|
235
|
-
1.14.2 / 2021-11-01
|
|
236
|
-
===================
|
|
237
|
-
|
|
238
|
-
## What's Changed
|
|
239
|
-
* fix: accept timestamps in snake case by @cyjake in https://github.com/cyjake/leoric/pull/221
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.1...v1.14.2
|
|
243
|
-
|
|
244
|
-
1.14.1 / 2021-11-01
|
|
245
|
-
===================
|
|
246
|
-
|
|
247
|
-
## What's Changed
|
|
248
|
-
* docs: export { Collection } by @cyjake in https://github.com/cyjake/leoric/pull/220
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.14.0...v1.14.1
|
|
252
|
-
|
|
253
|
-
1.14.0 / 2021-11-01
|
|
254
|
-
===================
|
|
255
|
-
|
|
256
|
-
Two options regarding `Model.init()` were added in this release:
|
|
257
|
-
|
|
258
|
-
```js
|
|
259
|
-
class User extends Bone {}
|
|
260
|
-
User.init({ name: STRING }, {
|
|
261
|
-
timestamps: true, // which is the default
|
|
262
|
-
paranoid: true, // which default to `false`
|
|
263
|
-
});
|
|
264
|
-
assert.deepEqual(Object.keys(User.attributes), [
|
|
265
|
-
'id',
|
|
266
|
-
'name',
|
|
267
|
-
'createdAt',
|
|
268
|
-
'updatedAt',
|
|
269
|
-
'deletedAt',
|
|
270
|
-
]);
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
## What's Changed
|
|
274
|
-
* docs: update 'primayKey' typos by @freshgum-bubbles in https://github.com/cyjake/leoric/pull/211
|
|
275
|
-
* docs: DataTypes definitions in d.ts by @cyjake in https://github.com/cyjake/leoric/pull/210
|
|
276
|
-
* fix: fix#209 sequelize mode should update all changed fields in instance update method by @JimmyDaddy in https://github.com/cyjake/leoric/pull/212
|
|
277
|
-
* fix: fix #213 findAndCountAll should ignore attributes by @JimmyDaddy in https://github.com/cyjake/leoric/pull/214
|
|
278
|
-
* fix: opts.connectTimeout by @cyjake in https://github.com/cyjake/leoric/pull/216
|
|
279
|
-
* fix: reload instance with sharding key should not throw by @cyjake in https://github.com/cyjake/leoric/pull/217
|
|
280
|
-
* feat: timestamps should be defined by default by @cyjake in https://github.com/cyjake/leoric/pull/218
|
|
281
|
-
* fix: instance.reload() should not rely on `static findOne()` by @cyjake in https://github.com/cyjake/leoric/pull/219
|
|
282
|
-
|
|
283
|
-
## New Contributors
|
|
284
|
-
* @freshgum-bubbles made their first contribution in https://github.com/cyjake/leoric/pull/211
|
|
285
|
-
|
|
286
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.5...v1.14.0
|
|
287
|
-
|
|
288
|
-
1.13.5 / 2021-10-26
|
|
289
|
-
===================
|
|
290
|
-
|
|
291
|
-
## What's Changed
|
|
292
|
-
* docs: enhance aggregation query types & fix raw query result type by @cyjake in https://github.com/cyjake/leoric/pull/208
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.4...v1.13.5
|
|
296
|
-
|
|
297
|
-
1.13.4 / 2021-10-25
|
|
298
|
-
===================
|
|
299
|
-
|
|
300
|
-
## What's Changed
|
|
301
|
-
* docs: spell & model methods should be generic by @cyjake in https://github.com/cyjake/leoric/pull/206
|
|
302
|
-
* docs: enhance query options, instance type, and toJSON() result type by @cyjake in https://github.com/cyjake/leoric/pull/207
|
|
303
|
-
|
|
304
|
-
This version brings correct (and hopefully better) typescript definitions, with the dts checked continuously at test/types tests. With this version, users that have model types correctly pinned at Bone will get code completion including class fields. Such as:
|
|
305
|
-
|
|
306
|
-

|
|
307
|
-
|
|
308
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.3...v1.13.4
|
|
309
|
-
|
|
310
|
-
1.13.3 / 2021-10-21
|
|
311
|
-
===================
|
|
312
|
-
|
|
313
|
-
## What's Changed
|
|
314
|
-
* refactor: persist edge cases of type casting in integration tests by @cyjake in https://github.com/cyjake/leoric/pull/202
|
|
315
|
-
* docs: renaming attributes by @cyjake in https://github.com/cyjake/leoric/pull/203
|
|
316
|
-
* fix: JSON.uncast(string) should not serialize twice by @cyjake in https://github.com/cyjake/leoric/pull/205
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.2...v1.13.3
|
|
320
|
-
|
|
321
|
-
1.13.2 / 2021-10-18
|
|
322
|
-
===================
|
|
323
|
-
|
|
324
|
-
## What's Changed
|
|
325
|
-
* fix: attribute.uncast([]) and realm.connect with synchronized models by @cyjake in https://github.com/cyjake/leoric/pull/201
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.1...v1.13.2
|
|
329
|
-
|
|
330
|
-
1.13.1 / 2021-10-18
|
|
331
|
-
===================
|
|
332
|
-
|
|
333
|
-
## What's Changed
|
|
334
|
-
* fix: skip connecting if models are synchronized already by @cyjake in https://github.com/cyjake/leoric/pull/200
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.13.0...v1.13.1
|
|
338
|
-
|
|
339
|
-
1.13.0 / 2021-10-18
|
|
340
|
-
===================
|
|
341
|
-
|
|
342
|
-
## What's Changed
|
|
343
|
-
* docs: monthly updates of 2021.09; support dark mode by @cyjake in https://github.com/cyjake/leoric/pull/196
|
|
344
|
-
* feat: coerce literal values into accurate attribute type by @cyjake in https://github.com/cyjake/leoric/pull/197
|
|
345
|
-
* fix: dispatched result should be in attribute names by @cyjake in https://github.com/cyjake/leoric/pull/198
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
**Full Changelog**: https://github.com/cyjake/leoric/compare/v1.12.0...v1.13.0
|
|
349
|
-
|
|
350
|
-
1.12.0 / 2021-10-12
|
|
351
|
-
===================
|
|
352
|
-
|
|
353
|
-
* feat: support custom fields query and sequelize mode export rawAttributes (#192)
|
|
354
|
-
* refactor: collection format query result (#194)
|
|
355
|
-
* refactor: object condition parsing and expression formatting (#191)
|
|
356
|
-
|
|
357
|
-
1.11.1 / 2021-09-28
|
|
358
|
-
===================
|
|
359
|
-
|
|
360
|
-
This version fixes lots of issues regarding logical operator in object conditions.
|
|
361
|
-
|
|
362
|
-
* fix: logical operator with multiple conditions such as (#190)
|
|
363
|
-
* fix: sequelize mode support HAVING, and select fields raw sql support (#187)
|
|
364
|
-
* fix: support len validator (#188)
|
|
365
|
-
* fix: normalize logical operator conditions before formatting with spellbook (#186)
|
|
366
|
-
|
|
367
|
-
1.11.0 / 2021-09-24
|
|
368
|
-
===================
|
|
369
|
-
|
|
370
|
-
* feat: support BINARY(length), VARBINARY(length), and BLOB (#169)
|
|
371
|
-
* fix: logic operate should adapt one argument (#183)
|
|
372
|
-
* fix: Bone.load() should be idempotent, make sure associations is intact (#184)
|
|
373
|
-
* fix: selected instance isNewRecord is false (#182)
|
|
374
|
-
* fix: set options.busyTimeout to mitigate SQLITE_BUSY (#176)
|
|
375
|
-
* fix: turn on long stack trace of sqlite driver (#175)
|
|
376
|
-
* docs: how to contribute (#180)
|
|
377
|
-
|
|
378
|
-
1.10.0 / 2021-09-14
|
|
379
|
-
===================
|
|
380
|
-
|
|
381
|
-
* feat: SQLite driver should emit "connection" event when new connection is created (#168)
|
|
382
|
-
* fix: bulkCreate(...records) should recognize custom setters (#168)
|
|
383
|
-
* fix: attribute.equals() check should ignore defaultValue (#172)
|
|
384
|
-
|
|
385
|
-
1.9.0 / 2021-09-04
|
|
386
|
-
==================
|
|
387
|
-
|
|
388
|
-
> should've been a major release but since existing users have all migrated to the new api...
|
|
389
|
-
|
|
390
|
-
* breaking: drop the deprecated `Model.describe()` (#167)
|
|
391
|
-
|
|
392
|
-
1.8.0 / 2021-08-30
|
|
393
|
-
==================
|
|
394
|
-
|
|
395
|
-
* feat: silent option fix #164 (#165)
|
|
396
|
-
* feat: binary type (#166)
|
|
397
|
-
|
|
398
|
-
1.7.1 / 2021-08-17
|
|
399
|
-
==================
|
|
400
|
-
|
|
401
|
-
* revert: drop Driver#recycleConnections due to poor interoperability (#162)
|
|
402
|
-
* fix: validator call array arguments (#160)
|
|
403
|
-
|
|
404
|
-
1.7.0 / 2021-08-17
|
|
405
|
-
=================
|
|
406
|
-
|
|
407
|
-
* feat: close connections that exceeds opts.idleTimeout (#159)
|
|
408
|
-
* feat: `opts.connectionLimit` support for SQLite (#159)
|
|
409
|
-
* feat: raw query relpacements, closes #149 (#155)
|
|
410
|
-
* fix: upsert created_at default (#154)
|
|
411
|
-
* test: validator unit test (#157)
|
|
412
|
-
* test: setup_hooks unit test (#158)
|
|
413
|
-
|
|
414
|
-
1.6.7 / 2021-08-05
|
|
415
|
-
==================
|
|
416
|
-
|
|
417
|
-
* fix: prevent from calling Date.prototype.toJSON (#153)
|
|
418
|
-
|
|
419
|
-
1.6.6 / 2021-07-22
|
|
420
|
-
==================
|
|
421
|
-
|
|
422
|
-
* fix: subclassing data type in dialects (#145)
|
|
423
|
-
* fix: where('width / height >= 16 / 9') (#144)
|
|
424
|
-
* docs: logging and sequelzie adapter (zh) (#142)
|
|
425
|
-
* test: include test/unit/utils (#143)
|
|
426
|
-
* test: more tests cases about sequelize adapter (#141)
|
|
427
|
-
|
|
428
|
-
1.6.5 / 2021-07-16
|
|
429
|
-
==================
|
|
430
|
-
|
|
431
|
-
* fix: define assign Bone.models #140
|
|
432
|
-
|
|
433
|
-
1.6.4 / 2021-07-16
|
|
434
|
-
==================
|
|
435
|
-
|
|
436
|
-
* refactor: connect({ Bone }) still necessary (#139)
|
|
437
|
-
* fix: formatting select join with subqueries should not tamper the subquery itself (#138)
|
|
438
|
-
* fix: describe table with more compatible syntax (#137)
|
|
439
|
-
|
|
440
|
-
1.6.3 / 2021-07-14
|
|
441
|
-
==================
|
|
442
|
-
|
|
443
|
-
* fix: transaction option passing in sequelize adapter (#136)
|
|
444
|
-
* fix: this.Model and proper Model.describe() (#135)
|
|
445
|
-
|
|
446
|
-
1.6.2 / 2021-07-09
|
|
447
|
-
==================
|
|
448
|
-
|
|
449
|
-
* fix: convert datetime in seconds/milliseconds back to Date (#134)
|
|
450
|
-
* fix: renamed attribute should remain enumerable (#133)
|
|
451
|
-
|
|
452
|
-
1.6.1 / 2021-07-07
|
|
453
|
-
==================
|
|
454
|
-
|
|
455
|
-
* fix: collection convert should handle tddl results as well (#132)
|
|
456
|
-
|
|
457
|
-
1.6.0 / 2021-07-06
|
|
458
|
-
==================
|
|
459
|
-
|
|
460
|
-
* feat: support class static attributes and hooks (#131)
|
|
461
|
-
* fix: names defined in Bone.attributes should always be enumerable (#128)
|
|
462
|
-
* chore: add quality badge to readme (#129)
|
|
463
|
-
|
|
464
|
-
1.5.2 / 2021-07-02
|
|
465
|
-
==================
|
|
466
|
-
|
|
467
|
-
* fix: leave the getter properties defined in class syntax as is (#127)
|
|
468
|
-
|
|
469
|
-
1.5.1 / 2021-06-30
|
|
470
|
-
==================
|
|
471
|
-
|
|
472
|
-
* fix: export Logger and Spell to let users intercept lower level api calls (#126)
|
|
473
|
-
|
|
474
|
-
1.5.0 / 2021-06-30
|
|
475
|
-
==================
|
|
476
|
-
|
|
477
|
-
* feat: provide Bone.pool to be backward compatible with v0.x (#124)
|
|
478
|
-
* feat: complete bone/spine.restore and Bone API type definitions (#125)
|
|
479
|
-
* feat: support more data types (mediumtext, mediumint, char, date...) (#123)
|
|
480
|
-
|
|
481
|
-
1.4.1 / 2021-06-25
|
|
482
|
-
==================
|
|
483
|
-
|
|
484
|
-
* refactor: simplify legacy timestamps support (#120)
|
|
485
|
-
* refactor: do not subclass Bone unless asked specifically (#120)
|
|
486
|
-
|
|
487
|
-
1.4.0 / 2021-06-24
|
|
488
|
-
==================
|
|
489
|
-
|
|
490
|
-
* feat: `realm.raw('SELECT ...')` and `Model.raw('SELECT ...')` (#94)
|
|
491
|
-
* feat: support multiple order rules in one single string or one-dimensional array (#92)
|
|
492
|
-
* feat: `Model.truncate()` now uses TRUNCATE if possible
|
|
493
|
-
* feat: `Model.find().optimizerHints('SET_VAR(foreign_key_checks=OFF)')`
|
|
494
|
-
* fix: Bone.bulkCreate() should not throw when called with non attribute (#117)
|
|
495
|
-
* fix: batch upsert (#108)
|
|
496
|
-
* fix: make sure connection is passed around in all queries carried out within transaction (#105)
|
|
497
|
-
* fix: update, sequelize mode get API, destroy compitable (#104)
|
|
498
|
-
* fix: `setDataValue` in sequelize adapter should not check prop name strictly
|
|
499
|
-
* refactor: spell_insert (#118)
|
|
500
|
-
* docs: about egg-orm & migrations (#119)
|
|
501
|
-
* docs: revise instructions for installing Jekyll (#111)
|
|
502
|
-
* docs: migrations, validations, hooks, and sequelize adapter (#103)
|
|
503
|
-
* docs: contributing guides
|
|
504
|
-
|
|
505
|
-
1.3.0 / 2021-03-01
|
|
506
|
-
==================
|
|
507
|
-
|
|
508
|
-
* feat: hook support
|
|
509
|
-
* feat: dirty check (`changes()` & `previousChanges()`)
|
|
510
|
-
* feat: compatible with mysql longtext conversion
|
|
511
|
-
* feat: NOT condition
|
|
512
|
-
|
|
513
|
-
1.2.0 / 2020-12-10
|
|
514
|
-
==================
|
|
515
|
-
|
|
516
|
-
* feat: `Realm.prototype.transaction()` with async function support
|
|
517
|
-
* feat: `Realm.prototype.query()` for raw queries
|
|
518
|
-
* feat: `logger.logQuery(sql, duration, { Model, command })`
|
|
519
|
-
* feat: `logger.logQueryError(sql, err, duration, { Model, command })`
|
|
520
|
-
|
|
521
|
-
1.1.0 / 2020-11-23
|
|
522
|
-
==================
|
|
523
|
-
|
|
524
|
-
* feat: JSON and JSONB data types
|
|
525
|
-
* feat: support `stringifyObjects` option for mysql client
|
|
526
|
-
* feat: aggregate functions for sequelize adapter
|
|
527
|
-
* feat: `Spell.prototype.nodeify()`
|
|
528
|
-
|
|
529
|
-
1.0.3 / 2020-03-16
|
|
530
|
-
==================
|
|
531
|
-
|
|
532
|
-
* fix: replace `deep-equal` (which is bloated) with `util.isDeepStrictEqual`
|
|
533
|
-
|
|
534
|
-
1.0.2 / 2020-03-04
|
|
535
|
-
==================
|
|
536
|
-
|
|
537
|
-
* fix: driver.alterTable() with multiple columns to add in SQLite
|
|
538
|
-
|
|
539
|
-
1.0.1 / 2020-02-25
|
|
540
|
-
==================
|
|
541
|
-
|
|
542
|
-
* fix: bulkCreate in sequelize shim
|
|
543
|
-
|
|
544
|
-
1.0.0 / 2020-02-24
|
|
545
|
-
==================
|
|
546
|
-
|
|
547
|
-
First major release. Let's get serious with semver.
|
|
548
|
-
|
|
549
|
-
* feat: logger.logQuery(sql, duration) & logger.logQueryError(sql, err)
|
|
550
|
-
|
|
551
|
-
0.5.3 / 2020-02-22
|
|
552
|
-
==================
|
|
553
|
-
|
|
554
|
-
* fix: `connect({ sequelize, dialect, client })` to allow mandatory sqlite client
|
|
555
|
-
* fix: prevent queries being performed unless model is correctly connected
|
|
556
|
-
|
|
557
|
-
0.5.2 / 2020-02-21
|
|
558
|
-
==================
|
|
559
|
-
|
|
560
|
-
* fix: drop the default and unused `require('sqlite3')`
|
|
561
|
-
|
|
562
|
-
0.5.1 / 2020-02-21
|
|
563
|
-
==================
|
|
564
|
-
|
|
565
|
-
* fix: `connect({ client: '@journeyapps/sqlcipher' })`
|
|
566
|
-
|
|
567
|
-
0.5.0 / 2020-02-19
|
|
568
|
-
==================
|
|
569
|
-
|
|
570
|
-
* feat: `Bone.sync()` to synchronize model with database
|
|
571
|
-
* feat: `Bone.createMigrationFile()` to create migration file
|
|
572
|
-
* feat: `Bone.migrate()` to run migrations
|
|
573
|
-
* feat: `Bone.bulkCreate()` to bulk insert records
|
|
574
|
-
* feat: `require('leoric')` now exports `Realm` to connect with multiple databases
|
|
575
|
-
* feat: `realm.define()` to define models in an old fashioned way
|
|
576
|
-
* feat: `realm.connect()` to connect with database
|
|
577
|
-
* feat: SQLite support without hacking node-sqlite3
|
|
578
|
-
* feat: `Bone.DataTypes` for type references
|
|
579
|
-
* feat: `Bone.init()` to initialize models
|
|
580
|
-
* feat: an adaptor to use Leoric in (partially) Sequelize complaint API
|
|
581
|
-
* refactor: a complete re-write of JOIN queries
|
|
582
|
-
* refactor: added `Bone.driver` to better encapsulate and planish database nuances
|
|
583
|
-
|
|
584
|
-
0.4.5 / 2019-12-14
|
|
585
|
-
==================
|
|
586
|
-
|
|
587
|
-
* fix: prevent primary key from being overridden with incorrect `LAST_INSERT_ID()`
|
|
588
|
-
|
|
589
|
-
0.4.4 / 2019-07-15
|
|
590
|
-
==================
|
|
591
|
-
|
|
592
|
-
* fix: append default scope when declaring relations, fixes #10
|
|
593
|
-
|
|
594
|
-
0.4.3 / 2019-05-09
|
|
595
|
-
==================
|
|
596
|
-
|
|
597
|
-
* fix: prevent Bone.dispatch from creating duplicated records of main table
|
|
598
|
-
|
|
599
|
-
0.4.2 / 2019-04-26
|
|
600
|
-
==================
|
|
601
|
-
|
|
602
|
-
* feat: `Spell#orWhere()` and `Spell#orHaving()`
|
|
603
|
-
* feat: arithmetic operators
|
|
604
|
-
* feat: unary operators such as unary minus `-` and bit invertion `~`
|
|
605
|
-
* fix: unset attribute should be overwritable
|
|
606
|
-
* fix: `attributeChanged()` should be false if attribute is unset and not overwritten
|
|
607
|
-
* fix: subclass with incomplete getter/setter should be complemented
|
|
608
|
-
* fix: sharding key validation on `Bone.update()` and `Bone.save()`
|
|
609
|
-
* fix: sharding key should be along with primary key on `bone.remove()`
|
|
610
|
-
* fix: `Bone.cast()` should leave `null` as is
|
|
611
|
-
* fix: `INSERT ... UPDATE` with `id = LAST_INSERT_ID(id)` in MySQL
|
|
612
|
-
* fix: `Model.find({ name: { $op1, $op2 } })` object conditions with multiple operators
|
|
613
|
-
* fix: prefixing result set with qualifiers if query contains join relations and is not dispatchable
|
|
614
|
-
* fix: `Spell#$get(index)` with LIMIT
|
|
615
|
-
* doc: `Model.transaction()`
|
|
616
|
-
* doc: definition types with `index.d.ts`
|
|
617
|
-
|
|
618
|
-
0.4.1 / 2019-03-21
|
|
619
|
-
==================
|
|
620
|
-
|
|
621
|
-
* feat: premature sharding key validation
|
|
622
|
-
* fix: output complete SQL instead of parameterized query with values.
|
|
623
|
-
* fix: both `connect({ model })` and `connect({ models })` are allowed.
|
|
624
|
-
* doc: no more `.findOrCreate()`, just `.upsert()`
|
|
625
|
-
* doc: table of contents with kramdown's `{:toc}`
|
|
626
|
-
* chore: droped experimental sqlite3 support
|
|
627
|
-
|
|
628
|
-
0.4.0 / 2018-11-05
|
|
629
|
-
==================
|
|
630
|
-
|
|
631
|
-
* feat: PostgreSQL support
|
|
632
|
-
* feat: Transaction support
|
|
633
|
-
* upgrade: (forked) SQLite client updated to SQLite 3.24
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
0.3.0 / 2018-10-31
|
|
637
|
-
==================
|
|
638
|
-
|
|
639
|
-
* feat: SQLite support with a [forked sqlite3](https://github.com/cyjake/node-sqlite3)
|
|
640
|
-
* feat: mysql2 support (which is trivial since both mysql and mysql2 share the same API)
|
|
641
|
-
* refactor: Spell now formats SQL with the literals separated, which gets escaped by the corresponding client itself later on.
|
|
642
|
-
|
|
643
|
-
0.2.0 / 2018-01-03
|
|
644
|
-
==================
|
|
645
|
-
|
|
646
|
-
* breaking: renaming
|
|
647
|
-
|
|
648
|
-
0.1.8 / 2017-12-31
|
|
649
|
-
==================
|
|
650
|
-
|
|
651
|
-
* fix: implement `query.batch()` as async iterator
|
|
652
|
-
* fix: `NOT (expr)`
|
|
653
|
-
* fix: `IFNULL(foo, default)`
|
|
654
|
-
* fix: support `.select(name[])`, `.select(name => {})`, and `.select("...name")`
|
|
655
|
-
* doc: `Model => className` in association options
|
|
656
|
-
* doc: use [jsdoc](http://usejsdoc.org) to generate docs/api
|
|
657
|
-
* doc: `.include()`
|
|
658
|
-
|
|
659
|
-
0.1.7 / 2017-12-22
|
|
660
|
-
==================
|
|
661
|
-
|
|
662
|
-
* refactor: `{ type: 'op', name: 'as' }` renamed to `{ type: 'alias' }`
|
|
663
|
-
* feat: `{ type: 'mod' }` for modifier, currently only `DISTINCT` is recognized
|
|
664
|
-
* feat: unary operators like `!` and `NOT`
|
|
665
|
-
* feat: `IS` and `IS NOT`
|
|
666
|
-
* fix: logic operator precendences
|
|
667
|
-
* fix: polymorphic hasMany({ through }) relations
|
|
668
|
-
* fix: dispatching multiple results with joins correctly
|
|
669
|
-
|
|
670
|
-
0.1.6 / 2017-12-21
|
|
671
|
-
==================
|
|
672
|
-
|
|
673
|
-
* feat: proper `.first`, `.last`, `.all`, and `.get(index)`
|
|
674
|
-
* fix: accept `Date`, `boolean`, and `Set` values
|
|
675
|
-
* fix: `Model.unscoped`
|
|
676
|
-
* fix: `Model.remove({}, true)` should be unscoped
|
|
677
|
-
|
|
678
|
-
0.1.5 / 2017-12-20
|
|
679
|
-
==================
|
|
680
|
-
|
|
681
|
-
* refactor: encapsulate column names. Keep them from the users even if the query results can not be dispatched.
|
|
682
|
-
* fix: complicated groups with joins should discard the use of subquery.
|
|
683
|
-
* fix: camelCase should replace globally
|
|
684
|
-
* fix: avoid missing attribtue exception when toJSON/toObject
|
|
685
|
-
|
|
686
|
-
0.1.4 / 2017-12-18
|
|
687
|
-
==================
|
|
688
|
-
|
|
689
|
-
* fix: should format condition arrays by hand instead of hand it over to formatExpr
|
|
690
|
-
* fix: whereConditions of subquery should retain the order of the whereConditions in major query
|
|
691
|
-
* fix: calculated columns should be kept in the final columns when sorting out the attributes
|
|
692
|
-
* fix: doesn't depend on co anymore
|
|
693
|
-
|
|
694
|
-
0.1.3 / 2017-12-17
|
|
695
|
-
==================
|
|
696
|
-
|
|
697
|
-
* fix: `select distict foo from table`;
|
|
698
|
-
* fix: `where (a = 1 or a = 2) and b = 3`;
|
|
699
|
-
* doc: a syntax table to provide a better glance over the querying ability.
|
|
700
|
-
|
|
701
|
-
0.1.2 / 2017-12-14
|
|
702
|
-
==================
|
|
703
|
-
|
|
704
|
-
* fix: copy left table's orders into subquery to make order/limit work when combined.
|
|
705
|
-
* fix: errors should be thrown when accessing attributes that weren't selected at the first place.
|
|
706
|
-
|
|
707
|
-
0.1.1 / 2017-12-13
|
|
708
|
-
==================
|
|
709
|
-
|
|
710
|
-
* refactor: automatic versioning on spells. When client calls query methods with chaining, new versions of spell gets duplicated. Makes reuse of spells possible.
|
|
711
|
-
* doc: english verion is almost complete <http://cyj.me/leoric>.
|
|
712
|
-
|
|
713
|
-
0.1.0 / 2017-12-09
|
|
714
|
-
==================
|
|
715
|
-
|
|
716
|
-
* Initial version, covers basic usage such as model authoring, database connection, query interface, and association.
|