With the new TypeORM-Release 0.2.30 a very important feature has been added — the option to delete orphaned rows on a one-to-many relationship. Instead of only deleting relationships between entities now you have the possibility to let automatically remove the child entities as well. With a very simple example we want to show you how.


  • Existing TypeORM project connected to a PostgreSQL database

In our example we have two entities:

  • LocationEntity
  • RoomEntity

A location can have multiple rooms. A room can only have one location.

The LocationEntity:

Here we can see the LocationEntity. It has the generated id…

Serdar Nurgün

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store