Why is the field "contribution_id" in "civicrm_line_item" sometimes NULL
For every contribution, a line_item is being created. The contribution_id field is the FK reference to the civicrm_contribution table. 

If I manually delete the Contribution record related to the Contact, the contribution gets deleted from civicrm_contribution table, which results in contribution_id to be NULL in civicrm_line_item.