Repository: typeorm/typeorm
File: src/query-builder/SoftDeleteQueryBuilder.ts (TypeScript)

Code before:
                )
                break
            default:
                throw new TypeORMError(
                    `The queryType must be "soft-delete" or "restore"`,
                )
        }
        if (metadata.versionColumn)
            updateColumnAndValues.push(
                this.escape(metadata.versionColumn.databaseName) +
                    " = " +
                    this.escape(metadata.versionColumn.databaseName) +
                    " + 1",
            )
        if (metadata.updateDateColumn)
            updateColumnAndValues.push(
                this.escape(metadata.updateDateColumn.databaseName) +
                    " = CURRENT_TIMESTAMP",
            ) // todo: fix issue with CURRENT_TIMESTAMP(6) being used, can "DEFAULT" be used?!

        if (updateColumnAndValues.length <= 0) {
            throw new UpdateValuesMissingError()
        }

        // only update rows that are not already soft deleted
        this.expressionMap.wheres.push({
            type: "and",
            condition: this.getWhereCondition(
                `${
                    this.expressionMap.mainAlias!.metadata.deleteDateColumn
                        ?.propertyName
                } IS ${
                    this.expressionMap.queryType === "soft-delete"
                        ? "NULL"
                        : "NOT NULL"
                }`,
            ),
        })

        // get a table name and all column database names
        const whereExpression = this.createWhereExpression()
        const returningExpression = this.createReturningExpression("update")

        if (returningExpression === "") {
            return `UPDATE ${this.getTableName(
                this.getMainTableName(),
            )} SET ${updateColumnAndValues.join(", ")}${whereExpression}` // todo: how do we replace aliases in where to nothing?
        }
        if (this.connection.driver.options.type === "mssql") {
            return `UPDATE ${this.getTableName(
                this.getMainTableName(),

Review comment (suggestion):
I wonder what would happen if there's an OR in the condition, e.g.:

```ts
repo.softDelete([{ id: 1 }, { id: 2 }])
```

I'd also add this to the test to prevent future regressions.

Code after:
                break
            default:
                throw new TypeORMError(
                    `The queryType must be "soft-delete" or "restore"`,
                )
        }
        if (metadata.versionColumn)
            updateColumnAndValues.push(
                this.escape(metadata.versionColumn.databaseName) +
                    " = " +
                    this.escape(metadata.versionColumn.databaseName) +
                    " + 1",
            )
        if (metadata.updateDateColumn)
            updateColumnAndValues.push(
                this.escape(metadata.updateDateColumn.databaseName) +
                    " = CURRENT_TIMESTAMP",
            ) // todo: fix issue with CURRENT_TIMESTAMP(6) being used, can "DEFAULT" be used?!

        if (updateColumnAndValues.length <= 0) {
            throw new UpdateValuesMissingError()
        }

        // only update rows that are not already soft deleted
        this.expressionMap.wheres.push({
            type: "and",
            condition: `${this.escape(
                metadata.deleteDateColumn.databaseName,
            )} IS ${
                this.expressionMap.queryType === "soft-delete"
                    ? "NULL"
                    : "NOT NULL"
            }`,
        })

        // get a table name and all column database names
        const whereExpression = this.createWhereExpression()
        const returningExpression = this.createReturningExpression("update")

        if (returningExpression === "") {
            return `UPDATE ${this.getTableName(
                this.getMainTableName(),
            )} SET ${updateColumnAndValues.join(", ")}${whereExpression}` // todo: how do we replace aliases in where to nothing?
        }
        if (this.connection.driver.options.type === "mssql") {
            return `UPDATE ${this.getTableName(
                this.getMainTableName(),
            )} SET ${updateColumnAndValues.join(
                ", ",
            )} OUTPUT ${returningExpression}${whereExpression}`
        }