Fixed database test fixture with out-of-order inserts leading to FK violations
(cherry picked from commit ba5175a57a7cdcf20bfd6274b88e2681db98db85)