Skip to content

Commit

Permalink
do not fail on existing site for repo id (DLC-1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Sep 26, 2024
1 parent 0b384ee commit 8afb21f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions db/migrate/20240925215831_add_repository_site_records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ def change
repository_ids = %w(NNC-A NNC-EA NNC-RB NyNyCAP NyNyCBL NyNyCMA)
direction.up do
repository_ids.each do |repository_id|
site = Site.create(slug: repository_id, layout: Site::LAYOUT_REPOSITORIES, search_type: Site::SEARCH_REPOSITORIES)
site.update(layout: Site::LAYOUT_REPOSITORIES, search_type: Site::SEARCH_REPOSITORIES)
site.save
site = Site.find_by(slug: repository_id)
if site
site.update(layout: Site::LAYOUT_REPOSITORIES, search_type: Site::SEARCH_REPOSITORIES)
site.save
else
site = Site.create(slug: repository_id, layout: Site::LAYOUT_REPOSITORIES, search_type: Site::SEARCH_REPOSITORIES)
end
end
end
direction.down do
Expand Down

0 comments on commit 8afb21f

Please sign in to comment.