fix orphaned files and add FK to attachments

fixes CNVS-10592

test plan
 - have an attachment that has a root_attachment
 - delete the root_attachment out of the db
 - run migrations
 - a root_attachment should be created with same id
 - you should not be able to delete a referenced
   root_attachment after migrations

Change-Id: I681d569b14bcc52199a4123d291daaa7a37ad13d
Reviewed-on: https://gerrit.instructure.com/28821
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>