Skip to content
Snippets Groups Projects
Unverified Commit b2454252 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

jobify migration

parent cb391754
No related branches found
No related tags found
No related merge requests found
class MigrateWebsiteConnectionsJob < ApplicationJob
queue_as :default
def perform(website_id)
website = Communication::Website.find(website_id)
website.pages.find_each(&:connect_dependencies)
website.posts.find_each(&:connect_dependencies)
website.categories.find_each(&:connect_dependencies)
website.menus.find_each(&:connect_dependencies)
website.connect(website.about, website) if website.about.present?
website.destroy_obsolete_connections
website.sync_with_git
website.destroy_obsolete_git_files
end
end
......@@ -9,16 +9,7 @@ namespace :app do
desc 'Fix things'
task fix: :environment do
Communication::Website.find_each do |website|
# Rebuild connections
website.pages.find_each(&:connect_dependencies)
website.posts.find_each(&:connect_dependencies)
website.categories.find_each(&:connect_dependencies)
website.menus.find_each(&:connect_dependencies)
website.connect(website.about, website) if website.about.present?
website.destroy_obsolete_connections
website.sync_with_git
website.destroy_obsolete_git_files
MigrateWebsiteConnectionsJob.perform_later(website.id)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment