title: How to auto-remove orphaned rows in TypeORM?
body: <p>I have a one-to-many relation in TypeORM and I would like to delete rows from the many side of the relationship rather than unlinking them by setting their foreign key to null (the default behavior), leaving them orphaned.  How can this be done? I saw <a href="https://github.com/typeorm/typeorm/pull/1665" rel="nofollow noreferrer">a PR</a> for this feature but it was rejected. Is there a workaround or some other way to do this? Here's a simplified version of my code to give some context.</p>
  <pre class="lang-js prettyprint-override"><code>@Entity()
  @TableInheritance({ column: { name: 'type', type: 'text' } })
  export default class Geolocation {
    @PrimaryGeneratedColumn()
    id!: number;
  
    @IsGeoJSONPoint
    @Column('geography')
    point!: Point;
  }
  
  
  @ChildEntity('offer')
  export default class OfferGeolocation extends Geolocation {
    @ManyToOne(type =&gt; Offer, offer =&gt; offer.geolocations, { onDelete: 'CASCADE' })
    offer!: Offer;
  }
  
  
  @ChildEntity('business')
  export default class BusinessGeolocation extends Geolocation {
    @ManyToOne(type =&gt; Business, business =&gt; business.geolocations, { onDelete: 'CASCADE' })
    business!: Business;
  }
  
  
  @Entity()
  export default class Business {
    @PrimaryGeneratedColumn()
    id!: number;
  
    // I would like to remove orphaned business geolocations
    @OneToMany(type =&gt; BusinessGeolocation, businessGeolocation =&gt; businessGeolocation.business, { cascade: true })
    geolocations!: BusinessGeolocation[];
  }
  
  
  @Entity()
  export default class Offer {
    @PrimaryGeneratedColumn()
    id!: number;
  
    // I would like to remove orphaned offer geolocations as well
    @OneToMany(type =&gt; OfferGeolocation, offerGeolocation =&gt; offerGeolocation.offer, { cascade: true })
    geolocations!: OfferGeolocation[];
  }
  </code></pre>