objection 3.9.0 → 4.0.0-rc.1
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/lib/dbErrors/LICENSE +21 -0
- package/lib/dbErrors/errorCodes/mssql.js +19 -0
- package/lib/dbErrors/errorCodes/mysql.js +805 -0
- package/lib/dbErrors/errorCodes/postgres.js +241 -0
- package/lib/dbErrors/errors/CheckViolationError.js +10 -0
- package/lib/dbErrors/errors/ConstraintViolationError.js +3 -0
- package/lib/dbErrors/errors/DBError.js +9 -0
- package/lib/dbErrors/errors/DataError.js +3 -0
- package/lib/dbErrors/errors/ForeignKeyViolationError.js +11 -0
- package/lib/dbErrors/errors/NotNullViolationError.js +12 -0
- package/lib/dbErrors/errors/UniqueViolationError.js +12 -0
- package/lib/dbErrors/index.js +59 -0
- package/lib/dbErrors/parsers/mssql/DBError/CheckViolationError/parser.js +28 -0
- package/lib/dbErrors/parsers/mssql/DBError/DataError/parser.js +25 -0
- package/lib/dbErrors/parsers/mssql/DBError/ForeignKeyViolationError/parser.js +39 -0
- package/lib/dbErrors/parsers/mssql/DBError/NotNullViolationError/parser.js +30 -0
- package/lib/dbErrors/parsers/mssql/DBError/UniqueViolationError/parser.js +53 -0
- package/lib/dbErrors/parsers/mssql/DBError/parser.js +51 -0
- package/lib/dbErrors/parsers/mssql/DBError/util.js +16 -0
- package/lib/dbErrors/parsers/mysql/DBError/ConstraintViolationError/ForeignKeyViolationError/parser.js +43 -0
- package/lib/dbErrors/parsers/mysql/DBError/ConstraintViolationError/NotNullViolationError/parser.js +29 -0
- package/lib/dbErrors/parsers/mysql/DBError/ConstraintViolationError/UniqueViolationError/parser.js +27 -0
- package/lib/dbErrors/parsers/mysql/DBError/ConstraintViolationError/parser.js +23 -0
- package/lib/dbErrors/parsers/mysql/DBError/DataError/parser.js +24 -0
- package/lib/dbErrors/parsers/mysql/DBError/parser.js +28 -0
- package/lib/dbErrors/parsers/postgres/DBError/ConstraintViolationError/CheckViolationError/parser.js +18 -0
- package/lib/dbErrors/parsers/postgres/DBError/ConstraintViolationError/ForeignKeyViolationError/parser.js +18 -0
- package/lib/dbErrors/parsers/postgres/DBError/ConstraintViolationError/NotNullViolationError/parser.js +18 -0
- package/lib/dbErrors/parsers/postgres/DBError/ConstraintViolationError/UniqueViolationError/parser.js +40 -0
- package/lib/dbErrors/parsers/postgres/DBError/ConstraintViolationError/parser.js +25 -0
- package/lib/dbErrors/parsers/postgres/DBError/DataError/parser.js +16 -0
- package/lib/dbErrors/parsers/postgres/DBError/parser.js +27 -0
- package/lib/dbErrors/parsers/sqlite/DBError/ConstraintViolationError/CheckViolationError/parser.js +20 -0
- package/lib/dbErrors/parsers/sqlite/DBError/ConstraintViolationError/ForeignKeyViolationError/parser.js +20 -0
- package/lib/dbErrors/parsers/sqlite/DBError/ConstraintViolationError/NotNullViolationError/parser.js +27 -0
- package/lib/dbErrors/parsers/sqlite/DBError/ConstraintViolationError/UniqueViolationError/parser.js +28 -0
- package/lib/dbErrors/parsers/sqlite/DBError/ConstraintViolationError/parser.js +24 -0
- package/lib/dbErrors/parsers/sqlite/DBError/parser.js +23 -0
- package/lib/dbErrors/utils/sqlState.js +3 -0
- package/lib/initialize.js +1 -7
- package/lib/model/AjvValidator.js +51 -117
- package/lib/model/Model.js +84 -59
- package/lib/model/ModifierNotFoundError.js +1 -7
- package/lib/model/NotFoundError.js +1 -7
- package/lib/model/RelationDoesNotExistError.js +1 -7
- package/lib/model/ValidationError.js +3 -10
- package/lib/model/Validator.js +1 -7
- package/lib/model/getModel.js +7 -6
- package/lib/model/inheritModel.js +1 -7
- package/lib/model/modelBindKnex.js +4 -10
- package/lib/model/modelClone.js +5 -11
- package/lib/model/modelColPropMap.js +3 -10
- package/lib/model/modelId.js +3 -10
- package/lib/model/modelJsonAttributes.js +35 -16
- package/lib/model/modelParseRelations.js +2 -8
- package/lib/model/modelQueryProps.js +43 -27
- package/lib/model/modelSet.js +89 -41
- package/lib/model/modelTableMetadata.js +4 -11
- package/lib/model/modelToJson.js +8 -23
- package/lib/model/modelUtils.js +14 -13
- package/lib/model/modelValidate.js +3 -9
- package/lib/model/modelValues.js +5 -14
- package/lib/model/modelVisitor.js +1 -7
- package/lib/objection.js +33 -71
- package/lib/queryBuilder/FunctionBuilder.js +4 -11
- package/lib/queryBuilder/InternalOptions.js +4 -9
- package/lib/queryBuilder/JoinBuilder.js +5 -8
- package/lib/queryBuilder/QueryBuilder.js +126 -95
- package/lib/queryBuilder/QueryBuilderBase.js +41 -123
- package/lib/queryBuilder/QueryBuilderContext.js +2 -8
- package/lib/queryBuilder/QueryBuilderContextBase.js +2 -8
- package/lib/queryBuilder/QueryBuilderOperationSupport.js +7 -21
- package/lib/queryBuilder/QueryBuilderUserContext.js +1 -7
- package/lib/queryBuilder/RawBuilder.js +5 -13
- package/lib/queryBuilder/ReferenceBuilder.js +20 -48
- package/lib/queryBuilder/RelationExpression.js +18 -16
- package/lib/queryBuilder/StaticHookArguments.js +74 -16
- package/lib/queryBuilder/ValueBuilder.js +11 -13
- package/lib/queryBuilder/getJoinBuilder.js +10 -0
- package/lib/queryBuilder/graph/GraphLoader.js +304 -0
- package/lib/queryBuilder/graph/GraphNode.js +235 -0
- package/lib/queryBuilder/graph/GraphOptions.js +55 -248
- package/lib/queryBuilder/graph/GraphPlan.js +395 -0
- package/lib/queryBuilder/graph/GraphUpsert.js +466 -410
- package/lib/queryBuilder/graph/GraphWriter.js +1263 -0
- package/lib/queryBuilder/join/JoinResultColumn.js +1 -7
- package/lib/queryBuilder/join/JoinResultParser.js +6 -11
- package/lib/queryBuilder/join/RelationJoiner.js +66 -84
- package/lib/queryBuilder/join/TableNode.js +2 -8
- package/lib/queryBuilder/join/TableTree.js +3 -9
- package/lib/queryBuilder/join/utils.js +5 -15
- package/lib/queryBuilder/jsonDialects/JsonDialect.js +51 -0
- package/lib/queryBuilder/jsonDialects/MySqlJsonDialect.js +81 -0
- package/lib/queryBuilder/jsonDialects/PostgresJsonDialect.js +45 -0
- package/lib/queryBuilder/jsonDialects/SqliteJsonDialect.js +67 -0
- package/lib/queryBuilder/jsonDialects/index.js +44 -0
- package/lib/queryBuilder/operations/DelegateOperation.js +2 -8
- package/lib/queryBuilder/operations/DeleteOperation.js +13 -35
- package/lib/queryBuilder/operations/FindByIdOperation.js +7 -12
- package/lib/queryBuilder/operations/FindByIdsOperation.js +4 -8
- package/lib/queryBuilder/operations/FindOperation.js +14 -34
- package/lib/queryBuilder/operations/FirstOperation.js +6 -10
- package/lib/queryBuilder/operations/FromOperation.js +3 -9
- package/lib/queryBuilder/operations/InsertAndFetchOperation.js +13 -12
- package/lib/queryBuilder/operations/InsertGraphAndFetchOperation.js +4 -10
- package/lib/queryBuilder/operations/InsertGraphOperation.js +7 -18
- package/lib/queryBuilder/operations/InsertOperation.js +118 -43
- package/lib/queryBuilder/operations/InstanceDeleteOperation.js +5 -12
- package/lib/queryBuilder/operations/InstanceFindOperation.js +4 -11
- package/lib/queryBuilder/operations/InstanceInsertOperation.js +2 -8
- package/lib/queryBuilder/operations/InstanceUpdateOperation.js +7 -14
- package/lib/queryBuilder/operations/JoinRelatedOperation.js +5 -11
- package/lib/queryBuilder/operations/KnexOperation.js +2 -8
- package/lib/queryBuilder/operations/LimitPerParentOperation.js +7 -69
- package/lib/queryBuilder/operations/MergeOperation.js +5 -11
- package/lib/queryBuilder/operations/NoneOperation.js +2 -8
- package/lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js +20 -49
- package/lib/queryBuilder/operations/OnBuildKnexOperation.js +2 -8
- package/lib/queryBuilder/operations/OnBuildOperation.js +2 -8
- package/lib/queryBuilder/operations/OnErrorOperation.js +2 -8
- package/lib/queryBuilder/operations/QueryBuilderOperation.js +1 -7
- package/lib/queryBuilder/operations/RangeOperation.js +11 -26
- package/lib/queryBuilder/operations/RelateOperation.js +2 -8
- package/lib/queryBuilder/operations/ReturningOperation.js +3 -9
- package/lib/queryBuilder/operations/RunAfterOperation.js +2 -12
- package/lib/queryBuilder/operations/RunBeforeOperation.js +2 -8
- package/lib/queryBuilder/operations/UnrelateOperation.js +2 -8
- package/lib/queryBuilder/operations/UpdateAndFetchOperation.js +14 -17
- package/lib/queryBuilder/operations/UpdateOperation.js +39 -125
- package/lib/queryBuilder/operations/UpsertGraphAndFetchOperation.js +8 -11
- package/lib/queryBuilder/operations/UpsertGraphOperation.js +6 -12
- package/lib/queryBuilder/operations/WhereCompositeOperation.js +3 -9
- package/lib/queryBuilder/operations/WhereGroupOperation.js +2 -8
- package/lib/queryBuilder/operations/eager/EagerOperation.js +3 -9
- package/lib/queryBuilder/operations/eager/JoinEagerOperation.js +72 -10
- package/lib/queryBuilder/operations/eager/NaiveEagerOperation.js +2 -8
- package/lib/queryBuilder/operations/eager/WhereInEagerOperation.js +23 -44
- package/lib/queryBuilder/operations/fieldExpressions.js +122 -0
- package/lib/queryBuilder/operations/jsonApi/WhereJsonHasOperation.js +20 -0
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOperation.js +44 -0
- package/lib/queryBuilder/operations/jsonApi/WhereJsonTypeOperation.js +14 -0
- package/lib/queryBuilder/operations/select/SelectOperation.js +11 -21
- package/lib/queryBuilder/operations/select/Selection.js +19 -17
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +4 -10
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeOperation.js +4 -10
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js +4 -10
- package/lib/queryBuilder/operations/windowOrder.js +56 -0
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +3 -7
- package/lib/queryBuilder/parsers/relationExpressionParser.js +42 -43
- package/lib/queryBuilder/parsers/relationExpressionParser.pegjs +39 -36
- package/lib/queryBuilder/transformations/CompositeQueryTransformation.js +2 -8
- package/lib/queryBuilder/transformations/QueryTransformation.js +1 -7
- package/lib/queryBuilder/transformations/WrapMysqlModifySubqueryTransformation.js +3 -9
- package/lib/queryBuilder/transformations/index.js +3 -11
- package/lib/queryBuilder/whereGroups.js +9 -24
- package/lib/queryBuilder/withoutOrder.js +4 -11
- package/lib/relations/Relation.js +47 -28
- package/lib/relations/RelationDeleteOperation.js +4 -14
- package/lib/relations/RelationFindOperation.js +119 -90
- package/lib/relations/RelationInsertOperation.js +2 -8
- package/lib/relations/RelationOwner.js +5 -11
- package/lib/relations/RelationProperty.js +4 -10
- package/lib/relations/RelationUpdateOperation.js +4 -14
- package/lib/relations/RelationWriteResultOperation.js +15 -0
- package/lib/relations/belongsToMany/BelongsToManyDeleteOperation.js +23 -0
- package/lib/relations/belongsToMany/BelongsToManyFindOperation.js +35 -0
- package/lib/relations/belongsToMany/BelongsToManyInsertOperation.js +28 -0
- package/lib/relations/belongsToMany/BelongsToManyRelateOperation.js +16 -0
- package/lib/relations/belongsToMany/BelongsToManyRelation.js +276 -0
- package/lib/relations/belongsToMany/BelongsToManyUnrelateOperation.js +11 -0
- package/lib/relations/belongsToOne/BelongsToOneDeleteOperation.js +2 -8
- package/lib/relations/belongsToOne/BelongsToOneInsertOperation.js +6 -11
- package/lib/relations/belongsToOne/BelongsToOneRelateOperation.js +3 -9
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +8 -19
- package/lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js +53 -27
- package/lib/relations/hasMany/HasManyInsertOperation.js +8 -9
- package/lib/relations/hasMany/HasManyRelateOperation.js +5 -11
- package/lib/relations/hasMany/HasManyRelation.js +9 -11
- package/lib/relations/hasMany/HasManyUnrelateOperation.js +3 -9
- package/lib/relations/hasOne/HasOneRelation.js +2 -8
- package/lib/relations/hasOneThrough/HasOneThroughRelation.js +2 -8
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +10 -15
- package/lib/relations/manyToMany/ManyToManyMySqlModifyMixin.js +2 -8
- package/lib/relations/manyToMany/ManyToManyRelation.js +82 -50
- package/lib/relations/manyToMany/ManyToManySqliteModifyMixin.js +2 -8
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperation.js +5 -9
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperationBase.js +2 -8
- package/lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js +3 -9
- package/lib/relations/manyToMany/find/ManyToManyFindOperation.js +20 -59
- package/lib/relations/manyToMany/insert/ManyToManyInsertOperation.js +6 -11
- package/lib/relations/manyToMany/relate/ManyToManyRelateOperation.js +4 -10
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateMySqlOperation.js +3 -9
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js +5 -9
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js +3 -9
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +3 -9
- package/lib/relations/manyToMany/update/ManyToManyUpdateMySqlOperation.js +3 -9
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperation.js +5 -9
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +79 -64
- package/lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js +3 -9
- package/lib/transaction.js +3 -9
- package/lib/utils/assert.js +3 -11
- package/lib/utils/buildUtils.js +2 -8
- package/lib/utils/classUtils.js +1 -7
- package/lib/utils/createModifier.js +2 -8
- package/lib/utils/identifierMapping.js +23 -27
- package/lib/utils/internalPropUtils.js +1 -7
- package/lib/utils/knexUtils.js +84 -40
- package/lib/utils/mixin.js +3 -10
- package/lib/utils/normalizeIds.js +2 -8
- package/lib/utils/objectUtils.js +41 -60
- package/lib/utils/parseFieldExpression.js +29 -14
- package/lib/utils/promiseUtils/after.js +2 -8
- package/lib/utils/promiseUtils/afterReturn.js +2 -8
- package/lib/utils/promiseUtils/index.js +7 -16
- package/lib/utils/promiseUtils/isPromise.js +2 -8
- package/lib/utils/promiseUtils/map.js +25 -14
- package/lib/utils/promiseUtils/mapAfterAllReturn.js +2 -8
- package/lib/utils/promiseUtils/try.js +2 -8
- package/lib/utils/resolveModel.js +10 -17
- package/lib/utils/tmpColumnUtils.js +2 -9
- package/lib/utils/warnings.js +2 -14
- package/package.json +25 -17
- package/typings/objection/index.d.ts +3217 -2179
- package/lib/.eslintrc.json +0 -8
- package/lib/model/graph/ModelGraph.js +0 -80
- package/lib/model/graph/ModelGraphBuilder.js +0 -241
- package/lib/model/graph/ModelGraphEdge.js +0 -52
- package/lib/model/graph/ModelGraphNode.js +0 -253
- package/lib/queryBuilder/graph/GraphAction.js +0 -69
- package/lib/queryBuilder/graph/GraphData.js +0 -53
- package/lib/queryBuilder/graph/GraphFetcher.js +0 -199
- package/lib/queryBuilder/graph/GraphNodeDbExistence.js +0 -184
- package/lib/queryBuilder/graph/GraphOperation.js +0 -27
- package/lib/queryBuilder/graph/delete/GraphDelete.js +0 -73
- package/lib/queryBuilder/graph/delete/GraphDeleteAction.js +0 -88
- package/lib/queryBuilder/graph/insert/DeferredRelationGraphInsertAction.js +0 -57
- package/lib/queryBuilder/graph/insert/GraphInsert.js +0 -257
- package/lib/queryBuilder/graph/insert/GraphInsertAction.js +0 -238
- package/lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js +0 -92
- package/lib/queryBuilder/graph/patch/GraphPatch.js +0 -20
- package/lib/queryBuilder/graph/patch/GraphPatchAction.js +0 -277
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js +0 -31
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js +0 -126
- package/lib/queryBuilder/operations/jsonApi/WhereJsonHasPostgresOperation.js +0 -30
- package/lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectPostgresOperation.js +0 -37
- package/lib/queryBuilder/operations/jsonApi/WhereJsonPostgresOperation.js +0 -62
- package/lib/queryBuilder/operations/jsonApi/postgresJsonApi.js +0 -192
- package/lib/utils/wrapDbError.js +0 -50
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const { withoutOrder } = require('../../queryBuilder/withoutOrder');
|
|
1
|
+
import { ManyToManyFindOperation } from './find/ManyToManyFindOperation.js';
|
|
2
|
+
import { addWhereGroup } from '../../queryBuilder/whereGroups.js';
|
|
3
|
+
import { withoutOrder } from '../../queryBuilder/withoutOrder.js';
|
|
4
|
+
import { whereInKeys } from '../../utils/knexUtils.js';
|
|
6
5
|
|
|
7
6
|
// This mixin contains the shared code for all modify operations (update, delete, relate, unrelate)
|
|
8
7
|
// for ManyToManyRelation operations.
|
|
@@ -12,7 +11,7 @@ const { withoutOrder } = require('../../queryBuilder/withoutOrder');
|
|
|
12
11
|
// that we are able to `innerJoin` the join table to the query. Most SQL engines don't allow
|
|
13
12
|
// joins in updates or deletes. Join table is joined so that queries can reference the join
|
|
14
13
|
// table columns.
|
|
15
|
-
const ManyToManyModifyMixin = (Operation) => {
|
|
14
|
+
export const ManyToManyModifyMixin = (Operation) => {
|
|
16
15
|
return class extends Operation {
|
|
17
16
|
constructor(...args) {
|
|
18
17
|
super(...args);
|
|
@@ -42,13 +41,13 @@ const ManyToManyModifyMixin = (Operation) => {
|
|
|
42
41
|
this.removeFiltersFromMainQuery(builder);
|
|
43
42
|
|
|
44
43
|
// Add a single where clause that uses the created subquery. Updates
|
|
45
|
-
// that modify the join rows too
|
|
46
|
-
//
|
|
44
|
+
// that modify the join rows too filter by the ids that `onAfterBuild`
|
|
45
|
+
// fetches (#161).
|
|
47
46
|
addWhereGroup(builder, () =>
|
|
48
47
|
this.modifiesJoinTable
|
|
49
48
|
? builder.where((whereBuilder) =>
|
|
50
|
-
|
|
51
|
-
? this.applyIdFilterForRelatedTable(whereBuilder,
|
|
49
|
+
this.relatedIds
|
|
50
|
+
? this.applyIdFilterForRelatedTable(whereBuilder, this.relatedIds)
|
|
52
51
|
: this.applyModifyFilterForRelatedTable(whereBuilder),
|
|
53
52
|
)
|
|
54
53
|
: this.applyModifyFilterForRelatedTable(builder),
|
|
@@ -93,7 +92,7 @@ const ManyToManyModifyMixin = (Operation) => {
|
|
|
93
92
|
|
|
94
93
|
applyIdFilterForRelatedTable(builder, ids) {
|
|
95
94
|
const idRefs = this.relation.relatedModelClass.getIdRelationProperty().refs(builder);
|
|
96
|
-
return builder
|
|
95
|
+
return whereInKeys(builder, idRefs, ids);
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
// Only modifies the join rows that match the filters (#1853).
|
|
@@ -171,7 +170,3 @@ class ManyToManyModifyFindOperation extends ManyToManyFindOperation {
|
|
|
171
170
|
);
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
|
-
|
|
175
|
-
module.exports = {
|
|
176
|
-
ManyToManyModifyMixin,
|
|
177
|
-
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { ManyToManyModifyMixin } = require('./ManyToManyModifyMixin');
|
|
1
|
+
import { ManyToManyModifyMixin } from './ManyToManyModifyMixin.js';
|
|
4
2
|
|
|
5
3
|
// We need to override this mixin for mysql because mysql doesn't allow a
|
|
6
4
|
// statement that modifies the join table to read the join table in a
|
|
@@ -14,7 +12,7 @@ const { ManyToManyModifyMixin } = require('./ManyToManyModifyMixin');
|
|
|
14
12
|
// join rows that only differ in their other columns (#1853).
|
|
15
13
|
//
|
|
16
14
|
// https://stackoverflow.com/a/2314264/3729316
|
|
17
|
-
const ManyToManyMySqlModifyMixin = (Operation) => {
|
|
15
|
+
export const ManyToManyMySqlModifyMixin = (Operation) => {
|
|
18
16
|
return class extends ManyToManyModifyMixin(Operation) {
|
|
19
17
|
applyModifyFilterForJoinTable(builder) {
|
|
20
18
|
const { joinTableOwnerProp, joinTableRelatedProp } = this.relation;
|
|
@@ -49,7 +47,3 @@ const ManyToManyMySqlModifyMixin = (Operation) => {
|
|
|
49
47
|
}
|
|
50
48
|
};
|
|
51
49
|
};
|
|
52
|
-
|
|
53
|
-
module.exports = {
|
|
54
|
-
ManyToManyMySqlModifyMixin,
|
|
55
|
-
};
|
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import { getModel } from '../../model/getModel.js';
|
|
2
|
+
import { Relation } from '../Relation.js';
|
|
3
|
+
import { RelationProperty } from '../RelationProperty.js';
|
|
4
|
+
|
|
5
|
+
import { isSqlite, isMySql } from '../../utils/knexUtils.js';
|
|
6
|
+
import { inheritModel } from '../../model/inheritModel.js';
|
|
7
|
+
import { resolveModel } from '../../utils/resolveModel.js';
|
|
8
|
+
import { mapAfterAllReturn } from '../../utils/promiseUtils/index.js';
|
|
9
|
+
import { isFunction, isObject, isString } from '../../utils/objectUtils.js';
|
|
10
|
+
import { createModifier } from '../../utils/createModifier.js';
|
|
11
|
+
import { addWhereGroup } from '../../queryBuilder/whereGroups.js';
|
|
12
|
+
import { withoutOrder } from '../../queryBuilder/withoutOrder.js';
|
|
13
|
+
import { raw } from '../../queryBuilder/RawBuilder.js';
|
|
14
|
+
|
|
15
|
+
import { ManyToManyFindOperation } from './find/ManyToManyFindOperation.js';
|
|
16
|
+
import { ManyToManyInsertOperation } from './insert/ManyToManyInsertOperation.js';
|
|
17
|
+
import { ManyToManyRelateOperation } from './relate/ManyToManyRelateOperation.js';
|
|
18
|
+
|
|
19
|
+
import { ManyToManyUnrelateOperation } from './unrelate/ManyToManyUnrelateOperation.js';
|
|
20
|
+
import { ManyToManyUnrelateSqliteOperation } from './unrelate/ManyToManyUnrelateSqliteOperation.js';
|
|
21
|
+
import { ManyToManyUnrelateMySqlOperation } from './unrelate/ManyToManyUnrelateMySqlOperation.js';
|
|
22
|
+
|
|
23
|
+
import { ManyToManyUpdateOperation } from './update/ManyToManyUpdateOperation.js';
|
|
24
|
+
import { ManyToManyUpdateSqliteOperation } from './update/ManyToManyUpdateSqliteOperation.js';
|
|
25
|
+
import { ManyToManyUpdateMySqlOperation } from './update/ManyToManyUpdateMySqlOperation.js';
|
|
26
|
+
|
|
27
|
+
import { ManyToManyDeleteOperation } from './delete/ManyToManyDeleteOperation.js';
|
|
28
|
+
import { ManyToManyDeleteSqliteOperation } from './delete/ManyToManyDeleteSqliteOperation.js';
|
|
29
|
+
|
|
30
|
+
const nestedJoinTypes = {
|
|
31
|
+
rightJoin: 'right join',
|
|
32
|
+
rightOuterJoin: 'right outer join',
|
|
33
|
+
fullOuterJoin: 'full outer join',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export class ManyToManyRelation extends Relation {
|
|
37
|
+
get keySide() {
|
|
38
|
+
return 'join';
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
setMapping(mapping) {
|
|
35
42
|
const retVal = super.setMapping(mapping);
|
|
36
43
|
|
|
@@ -140,6 +147,7 @@ class ManyToManyRelation extends Relation {
|
|
|
140
147
|
relatedTable = defaultRelatedTable(this, builder),
|
|
141
148
|
ownerTable = defaultOwnerTable(this, builder),
|
|
142
149
|
joinTableAlias = defaultJoinTableAlias(this, relatedTableAlias, builder),
|
|
150
|
+
modifyJoin,
|
|
143
151
|
} = {},
|
|
144
152
|
) {
|
|
145
153
|
let relatedJoinSelect = this.applyModify(relatedJoinSelectQuery).as(relatedTableAlias);
|
|
@@ -162,27 +170,50 @@ class ManyToManyRelation extends Relation {
|
|
|
162
170
|
withoutOrder(joinTableSelect);
|
|
163
171
|
}
|
|
164
172
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const joinTableOwnerProp = this.joinTableOwnerProp;
|
|
168
|
-
|
|
173
|
+
const { ownerProp, relatedProp, joinTableOwnerProp, joinTableRelatedProp } = this;
|
|
174
|
+
const addOwnerConditions = (join) => {
|
|
169
175
|
ownerProp.forEach((i) => {
|
|
170
176
|
const joinTableOwnerRef = joinTableOwnerProp.ref(builder, i).table(joinTableAlias);
|
|
171
177
|
const ownerRef = ownerProp.ref(builder, i).table(ownerTable);
|
|
172
178
|
|
|
173
179
|
join.on(joinTableOwnerRef, ownerRef);
|
|
174
180
|
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
};
|
|
182
|
+
const getRelatedRefs = (i) => [
|
|
183
|
+
joinTableRelatedProp.ref(builder, i).table(joinTableAlias),
|
|
184
|
+
relatedProp.ref(builder, i).table(relatedTableAlias),
|
|
185
|
+
];
|
|
186
|
+
|
|
187
|
+
if (modifyJoin) {
|
|
188
|
+
// Nest the join of the related table in the join of the join table, so
|
|
189
|
+
// that the conditions of `modifyJoin()` cover both tables in one ON
|
|
190
|
+
// clause, and outer joins don't keep the join table rows they exclude.
|
|
191
|
+
// The nested join keeps the related rows that a right or full join keeps:
|
|
192
|
+
const nestedJoinType = nestedJoinTypes[joinOperation] || 'inner join';
|
|
193
|
+
const on = relatedProp.cols.map(() => '? = ?').join(' and ');
|
|
194
|
+
const nestedJoin = raw(
|
|
195
|
+
`(${getBinding(joinTableSelect)} ${nestedJoinType} ${getBinding(relatedJoinSelect)} on ${on})`,
|
|
196
|
+
[
|
|
197
|
+
joinTableSelect,
|
|
198
|
+
relatedJoinSelect,
|
|
199
|
+
...relatedProp.cols.flatMap((_, i) => getRelatedRefs(i)),
|
|
200
|
+
],
|
|
201
|
+
);
|
|
182
202
|
|
|
183
|
-
|
|
203
|
+
return builder[joinOperation](nestedJoin, (join) => {
|
|
204
|
+
addOwnerConditions(join);
|
|
205
|
+
this._applyModifyJoin(join, modifyJoin, {
|
|
206
|
+
owner: ownerTable,
|
|
207
|
+
related: relatedTableAlias,
|
|
208
|
+
joinTable: joinTableAlias,
|
|
209
|
+
});
|
|
184
210
|
});
|
|
185
|
-
}
|
|
211
|
+
} else {
|
|
212
|
+
builder[joinOperation](joinTableSelect, addOwnerConditions);
|
|
213
|
+
return builder[joinOperation](relatedJoinSelect, (join) => {
|
|
214
|
+
relatedProp.forEach((i) => join.on(...getRelatedRefs(i)));
|
|
215
|
+
});
|
|
216
|
+
}
|
|
186
217
|
}
|
|
187
218
|
|
|
188
219
|
find(_, owner) {
|
|
@@ -334,6 +365,11 @@ function defaultJoinTableAlias(relation, relatedTableAlias, builder) {
|
|
|
334
365
|
}
|
|
335
366
|
}
|
|
336
367
|
|
|
368
|
+
// Table names go in as identifiers, subqueries as values.
|
|
369
|
+
function getBinding(select) {
|
|
370
|
+
return isString(select) ? '??' : '?';
|
|
371
|
+
}
|
|
372
|
+
|
|
337
373
|
function aliasedTableName(tableName, alias) {
|
|
338
374
|
if (tableName === alias) {
|
|
339
375
|
return tableName;
|
|
@@ -554,7 +590,3 @@ function getDeleteOperationClass(builder) {
|
|
|
554
590
|
other: ManyToManyDeleteOperation,
|
|
555
591
|
});
|
|
556
592
|
}
|
|
557
|
-
|
|
558
|
-
module.exports = {
|
|
559
|
-
ManyToManyRelation,
|
|
560
|
-
};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { ManyToManyModifyMixin } = require('./ManyToManyModifyMixin');
|
|
1
|
+
import { ManyToManyModifyMixin } from './ManyToManyModifyMixin.js';
|
|
4
2
|
const SQLITE_BUILTIN_ROW_ID = '_rowid_';
|
|
5
3
|
|
|
6
4
|
// We need to override this mixin for sqlite because sqlite doesn't support
|
|
7
5
|
// multi-column where in statements with subqueries. We need to use the
|
|
8
6
|
// internal _rowid_ column instead.
|
|
9
|
-
const ManyToManySqliteModifyMixin = (Operation) => {
|
|
7
|
+
export const ManyToManySqliteModifyMixin = (Operation) => {
|
|
10
8
|
return class extends ManyToManyModifyMixin(Operation) {
|
|
11
9
|
applyModifyFilterForRelatedTable(builder) {
|
|
12
10
|
const tableRef = builder.tableRefFor(this.relation.relatedModelClass);
|
|
@@ -17,7 +15,3 @@ const ManyToManySqliteModifyMixin = (Operation) => {
|
|
|
17
15
|
}
|
|
18
16
|
};
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
ManyToManySqliteModifyMixin,
|
|
23
|
-
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyDeleteOperationBase } from './ManyToManyDeleteOperationBase.js';
|
|
2
|
+
import { ManyToManyModifyMixin } from '../ManyToManyModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ManyToManyDeleteOperation extends ManyToManyModifyMixin(ManyToManyDeleteOperationBase) {}
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
ManyToManyDeleteOperation,
|
|
10
|
-
};
|
|
4
|
+
export class ManyToManyDeleteOperation extends ManyToManyModifyMixin(
|
|
5
|
+
ManyToManyDeleteOperationBase,
|
|
6
|
+
) {}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeleteOperation } from '../../../queryBuilder/operations/DeleteOperation.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class ManyToManyDeleteOperationBase extends DeleteOperation {
|
|
3
|
+
export class ManyToManyDeleteOperationBase extends DeleteOperation {
|
|
6
4
|
constructor(name, opt) {
|
|
7
5
|
super(name, opt);
|
|
8
6
|
|
|
@@ -20,7 +18,3 @@ class ManyToManyDeleteOperationBase extends DeleteOperation {
|
|
|
20
18
|
throw new Error('not implemented');
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
module.exports = {
|
|
25
|
-
ManyToManyDeleteOperationBase,
|
|
26
|
-
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyDeleteOperationBase } from './ManyToManyDeleteOperationBase.js';
|
|
2
|
+
import { ManyToManySqliteModifyMixin } from '../ManyToManySqliteModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { ManyToManySqliteModifyMixin } = require('../ManyToManySqliteModifyMixin');
|
|
5
|
-
|
|
6
|
-
class ManyToManyDeleteSqliteOperation extends ManyToManySqliteModifyMixin(
|
|
4
|
+
export class ManyToManyDeleteSqliteOperation extends ManyToManySqliteModifyMixin(
|
|
7
5
|
ManyToManyDeleteOperationBase,
|
|
8
6
|
) {}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
ManyToManyDeleteSqliteOperation,
|
|
12
|
-
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { RelationFindOperation } from '../../RelationFindOperation.js';
|
|
2
|
+
import { getTempColumn } from '../../../utils/tmpColumnUtils.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { getTempColumn } = require('../../../utils/tmpColumnUtils');
|
|
5
|
-
const { warnOnce } = require('../../../utils/warnings');
|
|
6
|
-
|
|
7
|
-
class ManyToManyFindOperation extends RelationFindOperation {
|
|
4
|
+
export class ManyToManyFindOperation extends RelationFindOperation {
|
|
8
5
|
constructor(name, opt) {
|
|
9
6
|
super(name, opt);
|
|
10
7
|
|
|
@@ -36,7 +33,7 @@ class ManyToManyFindOperation extends RelationFindOperation {
|
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
if (this.owner.isModels) {
|
|
39
|
-
this.
|
|
36
|
+
this.checkOwnerProps();
|
|
40
37
|
|
|
41
38
|
if (this.assignResultToOwner) {
|
|
42
39
|
this.selectMissingJoinColumns(builder);
|
|
@@ -44,43 +41,9 @@ class ManyToManyFindOperation extends RelationFindOperation {
|
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (this.assignResultToOwner && this.owner.isModels) {
|
|
51
|
-
const owners = this.owner.modelArray;
|
|
52
|
-
const ownerProp = this.relation.ownerProp;
|
|
53
|
-
const relatedByOwnerId = new Map();
|
|
54
|
-
|
|
55
|
-
for (let i = 0, l = related.length; i < l; ++i) {
|
|
56
|
-
const rel = related[i];
|
|
57
|
-
const key = rel.$propKey(this.ownerJoinColumnAlias);
|
|
58
|
-
let arr = relatedByOwnerId.get(key);
|
|
59
|
-
|
|
60
|
-
if (!arr) {
|
|
61
|
-
arr = [];
|
|
62
|
-
relatedByOwnerId.set(key, arr);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
arr.push(rel);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this.warnOnMissingRelatedProps(related);
|
|
69
|
-
|
|
70
|
-
for (let i = 0, l = owners.length; i < l; ++i) {
|
|
71
|
-
const own = owners[i];
|
|
72
|
-
const key = ownerProp.propKey(own);
|
|
73
|
-
const related = relatedByOwnerId.get(key);
|
|
74
|
-
|
|
75
|
-
if (isOneToOne) {
|
|
76
|
-
own[this.relationProperty] = (related && related[0]) || null;
|
|
77
|
-
} else {
|
|
78
|
-
own[this.relationProperty] = related || [];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return related;
|
|
44
|
+
// @override
|
|
45
|
+
getOwnerKey(related) {
|
|
46
|
+
return related.$propKey(this.ownerJoinColumnAlias);
|
|
84
47
|
}
|
|
85
48
|
|
|
86
49
|
// @override
|
|
@@ -89,21 +52,21 @@ class ManyToManyFindOperation extends RelationFindOperation {
|
|
|
89
52
|
}
|
|
90
53
|
|
|
91
54
|
// The related models are assigned to their owners by the owner join columns
|
|
92
|
-
// selected from the join table.
|
|
93
|
-
// `$parseDatabaseJson()
|
|
94
|
-
|
|
95
|
-
|
|
55
|
+
// selected from the join table. They can get lost, e.g. in a custom
|
|
56
|
+
// `$parseDatabaseJson()` (#2258).
|
|
57
|
+
// @override
|
|
58
|
+
checkRelatedProps(related) {
|
|
59
|
+
const { name, ownerModelClass, joinTableOwnerProp } = this.relation;
|
|
96
60
|
|
|
97
61
|
for (let c = 0, lc = this.ownerJoinColumnAlias.length; c < lc; ++c) {
|
|
98
62
|
const alias = this.ownerJoinColumnAlias[c];
|
|
99
63
|
|
|
100
64
|
if (related.some((rel) => rel[alias] === undefined)) {
|
|
101
|
-
|
|
102
|
-
`
|
|
103
|
-
`
|
|
104
|
-
`
|
|
105
|
-
'
|
|
106
|
-
'of the related model keep it.',
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Unable to fetch relation "${name}" of ${ownerModelClass.name}: some related models ` +
|
|
67
|
+
`are missing the join table column "${joinTableOwnerProp.propDescription(c)}" ` +
|
|
68
|
+
`selected as "${alias}". Check that $parseDatabaseJson() and the column name ` +
|
|
69
|
+
'mappers of the related model keep it.',
|
|
107
70
|
);
|
|
108
71
|
}
|
|
109
72
|
}
|
|
@@ -127,13 +90,11 @@ class ManyToManyFindOperation extends RelationFindOperation {
|
|
|
127
90
|
const propName = relatedModelClass.columnNameToPropertyName(this.ownerJoinColumnAlias[i]);
|
|
128
91
|
|
|
129
92
|
builder.select(joinTableOwnerRef.as(this.ownerJoinColumnAlias[i]));
|
|
130
|
-
|
|
93
|
+
// Unlike the join props, these aliases are never kept, as they aren't
|
|
94
|
+
// props of the related model.
|
|
95
|
+
builder.addInternalSelection(propName);
|
|
131
96
|
});
|
|
132
97
|
|
|
133
98
|
super.selectMissingJoinColumns(builder);
|
|
134
99
|
}
|
|
135
100
|
}
|
|
136
|
-
|
|
137
|
-
module.exports = {
|
|
138
|
-
ManyToManyFindOperation,
|
|
139
|
-
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { hasBatchInsert } from '../../../utils/knexUtils.js';
|
|
2
|
+
import { RelationInsertOperation } from '../../RelationInsertOperation.js';
|
|
3
|
+
import { ManyToManyRelateOperation } from '../relate/ManyToManyRelateOperation.js';
|
|
4
|
+
import { assignRelated } from '../../../model/modelSet.js';
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
const { RelationInsertOperation } = require('../../RelationInsertOperation');
|
|
5
|
-
const { ManyToManyRelateOperation } = require('../relate/ManyToManyRelateOperation');
|
|
6
|
-
|
|
7
|
-
class ManyToManyInsertOperation extends RelationInsertOperation {
|
|
6
|
+
export class ManyToManyInsertOperation extends RelationInsertOperation {
|
|
8
7
|
onAdd(builder, args) {
|
|
9
8
|
const retVal = super.onAdd(builder, args);
|
|
10
9
|
|
|
@@ -26,7 +25,7 @@ class ManyToManyInsertOperation extends RelationInsertOperation {
|
|
|
26
25
|
|
|
27
26
|
if (this.assignResultToOwner && this.owner.isModels) {
|
|
28
27
|
for (const owner of this.owner.modelArray) {
|
|
29
|
-
owner
|
|
28
|
+
assignRelated(owner, this.relation, inserted, { append: true });
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -53,7 +52,3 @@ class ManyToManyInsertOperation extends RelationInsertOperation {
|
|
|
53
52
|
return inserted;
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
|
|
57
|
-
module.exports = {
|
|
58
|
-
ManyToManyInsertOperation,
|
|
59
|
-
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { isPostgres } from '../../../utils/knexUtils.js';
|
|
2
|
+
import { normalizeIds } from '../../../utils/normalizeIds.js';
|
|
3
|
+
import { RelateOperation } from '../../../queryBuilder/operations/RelateOperation.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
const { normalizeIds } = require('../../../utils/normalizeIds');
|
|
5
|
-
const { RelateOperation } = require('../../../queryBuilder/operations/RelateOperation');
|
|
6
|
-
|
|
7
|
-
class ManyToManyRelateOperation extends RelateOperation {
|
|
5
|
+
export class ManyToManyRelateOperation extends RelateOperation {
|
|
8
6
|
onAdd(builder, args) {
|
|
9
7
|
this.input = args[0];
|
|
10
8
|
this.ids = normalizeIds(args[0], this.relation.relatedProp);
|
|
@@ -81,7 +79,3 @@ function assertOwnerIsSingleItem(builder, owner, relation) {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
module.exports = {
|
|
86
|
-
ManyToManyRelateOperation,
|
|
87
|
-
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyUnrelateOperationBase } from './ManyToManyUnrelateOperationBase.js';
|
|
2
|
+
import { ManyToManyMySqlModifyMixin } from '../ManyToManyMySqlModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { ManyToManyMySqlModifyMixin } = require('../ManyToManyMySqlModifyMixin');
|
|
5
|
-
|
|
6
|
-
class ManyToManyUnrelateMySqlOperation extends ManyToManyMySqlModifyMixin(
|
|
4
|
+
export class ManyToManyUnrelateMySqlOperation extends ManyToManyMySqlModifyMixin(
|
|
7
5
|
ManyToManyUnrelateOperationBase,
|
|
8
6
|
) {}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
ManyToManyUnrelateMySqlOperation,
|
|
12
|
-
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyUnrelateOperationBase } from './ManyToManyUnrelateOperationBase.js';
|
|
2
|
+
import { ManyToManyModifyMixin } from '../ManyToManyModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ManyToManyUnrelateOperation extends ManyToManyModifyMixin(ManyToManyUnrelateOperationBase) {}
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
ManyToManyUnrelateOperation,
|
|
10
|
-
};
|
|
4
|
+
export class ManyToManyUnrelateOperation extends ManyToManyModifyMixin(
|
|
5
|
+
ManyToManyUnrelateOperationBase,
|
|
6
|
+
) {}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { UnrelateOperation } from '../../../queryBuilder/operations/UnrelateOperation.js';
|
|
2
|
+
import { addWhereGroup } from '../../../queryBuilder/whereGroups.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { addWhereGroup } = require('../../../queryBuilder/whereGroups');
|
|
5
|
-
|
|
6
|
-
class ManyToManyUnrelateOperationBase extends UnrelateOperation {
|
|
4
|
+
export class ManyToManyUnrelateOperationBase extends UnrelateOperation {
|
|
7
5
|
get modifiesJoinTable() {
|
|
8
6
|
return true;
|
|
9
7
|
}
|
|
@@ -36,7 +34,3 @@ class ManyToManyUnrelateOperationBase extends UnrelateOperation {
|
|
|
36
34
|
throw new Error('not implemented');
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
module.exports = {
|
|
41
|
-
ManyToManyUnrelateOperationBase,
|
|
42
|
-
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyUnrelateOperationBase } from './ManyToManyUnrelateOperationBase.js';
|
|
2
|
+
import { ManyToManySqliteModifyMixin } from '../ManyToManySqliteModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { ManyToManySqliteModifyMixin } = require('../ManyToManySqliteModifyMixin');
|
|
5
|
-
|
|
6
|
-
class ManyToManyUnrelateSqliteOperation extends ManyToManySqliteModifyMixin(
|
|
4
|
+
export class ManyToManyUnrelateSqliteOperation extends ManyToManySqliteModifyMixin(
|
|
7
5
|
ManyToManyUnrelateOperationBase,
|
|
8
6
|
) {}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
ManyToManyUnrelateSqliteOperation,
|
|
12
|
-
};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyUpdateOperationBase } from './ManyToManyUpdateOperationBase.js';
|
|
2
|
+
import { ManyToManyMySqlModifyMixin } from '../ManyToManyMySqlModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
const { ManyToManyMySqlModifyMixin } = require('../ManyToManyMySqlModifyMixin');
|
|
5
|
-
|
|
6
|
-
class ManyToManyUpdateMySqlOperation extends ManyToManyMySqlModifyMixin(
|
|
4
|
+
export class ManyToManyUpdateMySqlOperation extends ManyToManyMySqlModifyMixin(
|
|
7
5
|
ManyToManyUpdateOperationBase,
|
|
8
6
|
) {}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
ManyToManyUpdateMySqlOperation,
|
|
12
|
-
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ManyToManyUpdateOperationBase } from './ManyToManyUpdateOperationBase.js';
|
|
2
|
+
import { ManyToManyModifyMixin } from '../ManyToManyModifyMixin.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ManyToManyUpdateOperation extends ManyToManyModifyMixin(ManyToManyUpdateOperationBase) {}
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
ManyToManyUpdateOperation,
|
|
10
|
-
};
|
|
4
|
+
export class ManyToManyUpdateOperation extends ManyToManyModifyMixin(
|
|
5
|
+
ManyToManyUpdateOperationBase,
|
|
6
|
+
) {}
|