Skip to content

Commit

Permalink
fix: order of prefix building on seeding data
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed May 14, 2020
1 parent ba310e1 commit 932eda2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion db/seeds/development/base.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
client = Client.where(symbol: "DATACITE.TEST").first || FactoryBot.create(:client, provider: provider, symbol: ENV["MDS_USERNAME"], password: ENV["MDS_PASSWORD"])
if Prefix.where(uid: "10.14454").blank?
prefix = FactoryBot.create(:prefix, uid: "10.14454")
FactoryBot.create(:provider_prefix, provider_id: provider.symbol, prefix_id: prefix.uid)
### This creates both the client_prefix and the pprovider association
FactoryBot.create(:client_prefix, client_id: client.symbol, prefix_id: prefix.uid)
end
dois = FactoryBot.create_list(:doi, 10, client: client, state: "findable")
Expand Down
6 changes: 3 additions & 3 deletions db/seeds/development/consortium_transfer.seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
fail "Seed tasks can only be used in the development enviroment" if Rails.env.production?

after "development:base" do

provider = Provider.where(symbol: "QUECHUA").first || FactoryBot.create(:provider, symbol: "QUECHUA")
client = Client.where(symbol: "QUECHUA.TEXT").first || FactoryBot.create(:client, provider: provider, symbol: "QUECHUA.TEXT", password: ENV["MDS_PASSWORD"])
if Prefix.where(uid: "10.14459").blank?
prefix = FactoryBot.create(:prefix, uid: "10.14459")
FactoryBot.create(:provider_prefix, provider_id: provider.symbol, prefix_id: prefix.uid)
FactoryBot.create(:client_prefix, client_id: client.symbol, prefix_id: prefix.uid)
## one needs to create the provider first so the assignation is made
provider_prefix_id = FactoryBot.create(:provider_prefix, provider_id: provider.symbol, prefix_id: prefix.uid)
FactoryBot.create(:client_prefix, client_id: client.symbol, prefix_id: prefix.uid, provider_prefix_id: provider_prefix_id.uid)
end
dois = FactoryBot.create_list(:doi, 10, client: client, state: "findable")
FactoryBot.create_list(:event_for_datacite_related, 3, obj_id: dois.first.doi)
Expand Down

0 comments on commit 932eda2

Please sign in to comment.