@mikro-orm/knex 6.4.3-dev.9 → 6.4.3
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.
|
@@ -22,6 +22,7 @@ export declare class MySqlPlatform extends AbstractSqlPlatform {
|
|
|
22
22
|
scale?: number;
|
|
23
23
|
}): string;
|
|
24
24
|
getDefaultMappedType(type: string): Type<unknown>;
|
|
25
|
+
isNumericColumn(mappedType: Type<unknown>): boolean;
|
|
25
26
|
supportsUnsigned(): boolean;
|
|
26
27
|
/**
|
|
27
28
|
* Returns the default name of index for the given columns
|
|
@@ -49,6 +49,9 @@ class MySqlPlatform extends AbstractSqlPlatform_1.AbstractSqlPlatform {
|
|
|
49
49
|
}
|
|
50
50
|
return super.getDefaultMappedType(type);
|
|
51
51
|
}
|
|
52
|
+
isNumericColumn(mappedType) {
|
|
53
|
+
return super.isNumericColumn(mappedType) || [core_1.DecimalType, core_1.DoubleType].some(t => mappedType instanceof t);
|
|
54
|
+
}
|
|
52
55
|
supportsUnsigned() {
|
|
53
56
|
return true;
|
|
54
57
|
}
|
|
@@ -2,4 +2,5 @@ import type { Dictionary } from '@mikro-orm/core';
|
|
|
2
2
|
import { MonkeyPatchable } from '../../MonkeyPatchable';
|
|
3
3
|
export declare class SqliteTableCompiler extends MonkeyPatchable.Sqlite3DialectTableCompiler {
|
|
4
4
|
foreign(this: any, foreignInfo: Dictionary): void;
|
|
5
|
+
foreignKeys(this: any): string;
|
|
5
6
|
}
|
|
@@ -41,5 +41,31 @@ class SqliteTableCompiler extends MonkeyPatchable_1.MonkeyPatchable.Sqlite3Diale
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
foreignKeys() {
|
|
45
|
+
let sql = '';
|
|
46
|
+
const foreignKeys = (this.grouped.alterTable || []).filter((o) => o.method === 'foreign');
|
|
47
|
+
for (let i = 0, l = foreignKeys.length; i < l; i++) {
|
|
48
|
+
const foreign = foreignKeys[i].args[0];
|
|
49
|
+
const column = this.formatter.columnize(foreign.column);
|
|
50
|
+
const references = this.formatter.columnize(foreign.references);
|
|
51
|
+
const foreignTable = this.formatter.wrap(foreign.inTable);
|
|
52
|
+
/* istanbul ignore next */
|
|
53
|
+
let constraintName = foreign.keyName || '';
|
|
54
|
+
if (constraintName) {
|
|
55
|
+
constraintName = ' constraint ' + this.formatter.wrap(constraintName);
|
|
56
|
+
}
|
|
57
|
+
sql += `,${constraintName} foreign key(${column}) references ${foreignTable}(${references})`;
|
|
58
|
+
if (foreign.onDelete) {
|
|
59
|
+
sql += ` on delete ${foreign.onDelete}`;
|
|
60
|
+
}
|
|
61
|
+
if (foreign.onUpdate) {
|
|
62
|
+
sql += ` on update ${foreign.onUpdate}`;
|
|
63
|
+
}
|
|
64
|
+
if (foreign.deferrable) {
|
|
65
|
+
sql += ` deferrable initially ${foreign.deferrable}`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return sql;
|
|
69
|
+
}
|
|
44
70
|
}
|
|
45
71
|
exports.SqliteTableCompiler = SqliteTableCompiler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.4.3
|
|
3
|
+
"version": "6.4.3",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^6.4.
|
|
66
|
+
"@mikro-orm/core": "^6.4.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.
|
|
69
|
+
"@mikro-orm/core": "^6.0.0",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
package/query/QueryBuilder.js
CHANGED
|
@@ -1252,7 +1252,7 @@ class QueryBuilder {
|
|
|
1252
1252
|
}
|
|
1253
1253
|
wrapPaginateSubQuery(meta) {
|
|
1254
1254
|
const pks = this.prepareFields(meta.primaryKeys, 'sub-query');
|
|
1255
|
-
const subQuery = this.clone(['_orderBy', '_fields']).select(pks).groupBy(pks).limit(this._limit);
|
|
1255
|
+
const subQuery = this.clone(['_orderBy', '_fields', 'lockMode', 'lockTableAliases']).select(pks).groupBy(pks).limit(this._limit);
|
|
1256
1256
|
// revert the on conditions added via populateWhere, we want to apply those only once
|
|
1257
1257
|
for (const join of Object.values(subQuery._joins)) {
|
|
1258
1258
|
if (join.cond_) {
|