fix cross shard attachment bug
fix cross shard attachment bug

fixes CNVS-11511

test plan
 - upload a file on the default shard
 - in script console manually set the namespace to
   what it would be on the other shards account
 - upload the same file on a different shard
 - it should not cause a db FK error

Change-Id: I0338753202c5c68980bb7c2f3337ca3f4eefd650
Reviewed-on: https://gerrit.instructure.com/31051
Reviewed-by: Anthus Williams <9b0bb6d8221e7e7c0d84e929f259a97887b2819e@instructure.com>
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>
Product-Review: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>
QA-Review: Rob Orton <7e09c9d3e96378bf549fc283fd6e1e5b7014cc33@instructure.com>

jay3126/canvas-lms,greyhwndz/canvas-lms,venturehive/canvas-lms,wye0220/shindig-canvas,AndranikMarkosyan/lms,shidao-fm/canvas-lms,skmezanul/canvas-lms,venturehive/canvas-lms,samuels410/greatlakes-lms,arrivu/hoodemo,arrivu/arrivu-lms,wye0220/shindig-canvas,eCNAP/CANVAS,leftplusrightllc/canvas-lms,jay3126/canvas-lms,samuels410/greatlakes-lms,sfu/canvas-lms,SwinburneOnline/canvas-lms,utkarshx/canvas-lms,usmschuck/canvas,leftplusrightllc/canvas-lms,eCNAP/CANVAS,juoni/canvas-lms,va7map/canvas-lms,venturehive/canvas-lms,jay3126/canvas-lms,Unow/canvas-lms,instructure/canvas-lms,roxolan/canvas-lms,wrdsb/canvas-lms,wrdsb/canvas-lms,antoniuslin/canvas-lms,grahamb/canvas-lms,djbender/canvas-lms,snehakachroo1/LSI_replica,arrivu/arrivu-lms,eCNAP/CANVAS,arrivu/arrivu-lms,samuels410/greatlakes-lms,kyroskoh/canvas-lms,arrivu/hoodemo,usmschuck/canvas,AndranikMarkosyan/lms,usmschuck/canvas,antoniuslin/canvas-lms,snehakachroo1/LSI_replica,redconfetti/canvas-lms,shidao-fm/canvas-lms,matematikk-mooc/canvas-lms,eCNAP/CANVAS,Jyaasa/canvas-lms,Rvor/canvas-lms,snehakachroo1/LSI_replica,fronteerio/canvas-lms,skmezanul/canvas-lms,ShreniiNepal/shrenii_lmp,juoni/canvas-lms,fronteerio/canvas-lms,Rvor/canvas-lms,matematikk-mooc/canvas-lms,whalejasmine/canvas-lms,narigone/canvas,AndranikMarkosyan/lms,ShreniiNepal/shrenii_lmp,Rvor/canvas-lms,greyhwndz/canvas-lms,roxolan/canvas-lms,instructure/canvas-lms,fronteerio/canvas-lms,efrj/canvas-lms,instructure/canvas-lms,redconfetti/canvas-lms,gbleydon/canvas-lms,matematikk-mooc/canvas-lms,sdeleon28/canvas-lms,juoni/canvas-lms,instructure/canvas-lms,dgynn/canvas-lms,instructure/canvas-lms,efrj/canvas-lms,sfu/canvas-lms,HotChalk/canvas-lms,djbender/canvas-lms,narigone/canvas,HotChalk/canvas-lms,wye0220/shindig-canvas,Jyaasa/canvas-lms,va7map/canvas-lms,juoni/canvas-lms,roxolan/canvas-lms,Jyaasa/canvas-lms,usmschuck/canvas,sdeleon28/canvas-lms,gbleydon/canvas-lms,SwinburneOnline/canvas-lms,dgynn/canvas-lms,leftplusrightllc/canvas-lms,grahamb/canvas-lms,matematikk-mooc/canvas-lms,ShreniiNepal/shrenii_lmp,skmezanul/canvas-lms,greyhwndz/canvas-lms,Unow/canvas-lms,dgynn/canvas-lms,fronteerio/canvas-lms,va7map/canvas-lms,va7map/canvas-lms,tgroshon/canvas-lms,snehakachroo1/LSI_replica,kyroskoh/canvas-lms,AndranikMarkosyan/lms,wrdsb/canvas-lms,tgroshon/canvas-lms,kyroskoh/canvas-lms,utkarshx/canvas-lms,leftplusrightllc/canvas-lms,utkarshx/canvas-lms,greyhwndz/canvas-lms,instructure/canvas-lms,efrj/canvas-lms,efrj/canvas-lms,skmezanul/canvas-lms,Jyaasa/canvas-lms,Rvor/canvas-lms,whalejasmine/canvas-lms,venturehive/canvas-lms,tgroshon/canvas-lms,redconfetti/canvas-lms,sfu/canvas-lms,narigone/canvas,sfu/canvas-lms,dgynn/canvas-lms,antoniuslin/canvas-lms,roxolan/canvas-lms,HotChalk/canvas-lms,wrdsb/canvas-lms,sdeleon28/canvas-lms,arrivu/hoodemo,sfu/canvas-lms,HotChalk/canvas-lms,djbender/canvas-lms,whalejasmine/canvas-lms,instructure/canvas-lms,Unow/canvas-lms,sdeleon28/canvas-lms,SwinburneOnline/canvas-lms,narigone/canvas,redconfetti/canvas-lms,tgroshon/canvas-lms,grahamb/canvas-lms,shidao-fm/canvas-lms,grahamb/canvas-lms,SwinburneOnline/canvas-lms,samuels410/greatlakes-lms,djbender/canvas-lms,shidao-fm/canvas-lms,antoniuslin/canvas-lms,grahamb/canvas-lms,sfu/canvas-lms,kyroskoh/canvas-lms,utkarshx/canvas-lms,whalejasmine/canvas-lms,ShreniiNepal/shrenii_lmp,jay3126/canvas-lms,gbleydon/canvas-lms,sfu/canvas-lms