@spinajs/orm
Advanced tools
Comparing version 1.2.175 to 1.2.176
@@ -594,6 +594,11 @@ "use strict"; | ||
const driver = this.Orm.Connections.get(this.TargetModelDescriptor.Connection); | ||
await driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
const query = driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
this.whereNotIn(self.Relation.PrimaryKey, result.filter((x) => x.PrimaryKeyValue).map((x) => x.PrimaryKeyValue)); | ||
this.where(self.Relation.ForeignKey, self.owner.PrimaryKeyValue); | ||
}); | ||
query.setTable(this.TargetModelDescriptor.TableName); | ||
if (driver.Options.Database) { | ||
query.database(driver.Options.Database); | ||
} | ||
await query; | ||
this.empty(); | ||
@@ -605,6 +610,11 @@ await this.add(result); | ||
const driver = this.Orm.Connections.get(this.TargetModelDescriptor.Connection); | ||
await driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
const query = driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
this.whereNotIn(self.Relation.PrimaryKey, obj.filter((x) => x.PrimaryKeyValue).map((x) => x.PrimaryKeyValue)); | ||
this.where(self.Relation.ForeignKey, self.owner.PrimaryKeyValue); | ||
}); | ||
query.setTable(this.TargetModelDescriptor.TableName); | ||
if (driver.Options.Database) { | ||
query.database(driver.Options.Database); | ||
} | ||
await query; | ||
this.empty(); | ||
@@ -617,6 +627,11 @@ await this.add(obj); | ||
const driver = this.Orm.Connections.get(this.TargetModelDescriptor.Connection); | ||
await driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
const query = driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).andWhere(function () { | ||
this.whereNotIn(self.Relation.PrimaryKey, result.filter((x) => x.PrimaryKeyValue).map((x) => x.PrimaryKeyValue)); | ||
this.where(self.Relation.ForeignKey, self.owner.PrimaryKeyValue); | ||
}); | ||
query.setTable(this.TargetModelDescriptor.TableName); | ||
if (driver.Options.Database) { | ||
query.database(driver.Options.Database); | ||
} | ||
await query; | ||
this.empty(); | ||
@@ -635,2 +650,6 @@ await this.add(result); | ||
const query = driver.Container.resolve(builders_1.DeleteQueryBuilder, [driver, this.Relation.TargetModel]).whereIn(this.Relation.ForeignKey, data); | ||
query.setTable(this.TargetModelDescriptor.TableName); | ||
if (driver.Options.Database) { | ||
query.database(driver.Options.Database); | ||
} | ||
await query; | ||
@@ -637,0 +656,0 @@ _.remove(this, (o) => data.indexOf(o.PrimaryKeyValue) !== -1); |
{ | ||
"name": "@spinajs/orm", | ||
"version": "1.2.175", | ||
"version": "1.2.176", | ||
"description": "framework orm module", | ||
@@ -55,3 +55,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "700586c05e1d365a83180285ab5911bb88c18890" | ||
"gitHead": "17625a82f9e3b0a5a689b6fc8652911d19e822f2" | ||
} |
Sorry, the diff of this file is not supported yet
382584
6603