diff --git a/lib/pact_broker/db/seed_example_data.rb b/lib/pact_broker/db/seed_example_data.rb index a04da0b30..5c4ef47d8 100644 --- a/lib/pact_broker/db/seed_example_data.rb +++ b/lib/pact_broker/db/seed_example_data.rb @@ -1,4 +1,5 @@ require 'pact_broker/test/test_data_builder' +require 'pact_broker/pacticipants/service' module PactBroker module DB @@ -8,6 +9,7 @@ def self.call end def call + return unless database_empty? PactBroker::Test::TestDataBuilder.new .create_consumer("Example App", created_at: days_ago(16)) .create_provider("Example API", created_at: days_ago(16)) @@ -30,6 +32,10 @@ def call .create_provider_version_tag("dev", created_at: days_ago(1)) end + def database_empty? + PactBroker::Pacticipants::Service.find_all_pacticipants.empty? + end + def pact_1 seed_data_file("pact_1.json") end