From 670f42d7abc2dc6bebc8e97b027a1e7390a854ce Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Wed, 23 Nov 2022 11:56:48 +0000 Subject: [PATCH] seeding is now idempotent --- db/seeds.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index c9957df2e..bf40a59d1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -67,19 +67,19 @@ unless Rails.env.test? end end - OrganisationRelationship.create!( + OrganisationRelationship.find_or_create_by!( child_organisation: org, parent_organisation: housing_provider1, ) - OrganisationRelationship.create!( + OrganisationRelationship.find_or_create_by!( child_organisation: org, parent_organisation: housing_provider2, ) - OrganisationRelationship.create!( + OrganisationRelationship.find_or_create_by!( child_organisation: managing_agent1, parent_organisation: org, ) - OrganisationRelationship.create!( + OrganisationRelationship.find_or_create_by!( child_organisation: managing_agent2, parent_organisation: org, )