Updated gate data fid building to account new primary key including fk_gate