Skip to content

Unable to delete entire table using Repository/EntityManager API #11455

@qqruz-mck

Description

@qqruz-mck

Issue description

In previous versions, it was possible to delete all rows from a table by passing an empty object {} as a filter. This functionality was broken in a new release, introduced in a commit marked as a fix, not as a breaking change.

Expected Behavior

Passing an empty object should delete all rows in the table.

Actual Behavior

The new version throws the following error:
Empty criteria(s) are not allowed for the delete method.

Steps to reproduce

await repository.delete({})

My Environment

Dependency Version
Operating System macOS 15.4.1
Node.js version 22.15.0
Typescript version 5.8.3
TypeORM version 0.3.23

Additional Context

This behavior was consistent with TypeORM’s API as well as with the API of other libraries across the Node.js ecosystem.

Given that this is one of the most widely used ORMs in the ecosystem this type of changes need to be properly documented as they have impact across many projects.

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions