5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 17:46:22 +00:00
panel/db/migrate/20230921155401_site_rename_origin_to_upstream.rb
f b06b829357
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
fix: necesita un bloque
2023-09-21 13:10:26 -03:00

20 lines
596 B
Ruby

# frozen_string_literal: true
# Renombrar todos los repositorios que apunten a skel como su origin
class SiteRenameOriginToUpstream < ActiveRecord::Migration[6.1]
# Renombrar
def up
Site.find_each do |site|
next unless site.repository.origin&.url == ENV['SKEL_SUTTY']
site.repository.rugged.remotes.rename('origin', 'upstream') do |_|
Rails.logger.info "#{site.name}: renamed origin to upstream"
end
rescue Rugged::Error, Rugged::OSError => e
Rails.logger.warn "#{site.name}: #{e.message}"
end
end
# No se puede deshacer
def down; end
end