title: TypeORM Cascade Delete
body: <p>Am having troubles deleting my entities, i have the following partial codes</p>
  
  <pre><code>@ManyToOne(type =&gt; Comment, comment =&gt; comment.replies, {
      onDelete: "CASCADE"
  })
  parent: Comment;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@OneToMany(type =&gt; Comment, comment =&gt; comment.parent)
  replies: Comment[];
  </code></pre>
  
  <p>I have tried <code>manager.remove(comment)</code> and</p>
  
  <pre><code>await manager
      .createQueryBuilder()
      .delete()
      .from(Comment)
      .where("id = :id", { id: comment.id })
      .execute();
  </code></pre>
  
  <p>Both don't work, is there something am doing wrong, how do I go about this, here is my select query</p>
  
  <pre><code>let comment = await manager
      .createQueryBuilder(Comment, "comment")
      .leftJoinAndSelect("comment.user", "user")
      .where("comment.id = :id", { id: request.body.comment })
      .getOne();
  </code></pre>
  
  <p>The error am getting is</p>
  
  <pre><code>UnhandledPromiseRejectionWarning: QueryFailedError: ER_ROW_IS_REFERENCED_2: Cannot delete or update a parent row: a foreign key constraint fails
  </code></pre>
  
  <p>Thanks in advance.</p>