Sha256: 484cd06b49e25a75c9a3e2138fbb456da7582f4955e679305debbfed753f129e
Contents?: true
Size: 840 Bytes
Versions: 6
Compression:
Stored size: 840 Bytes
Contents
class AddOrganizationIdToServiceUser < ActiveRecord::Migration[6.1] def up add_column :foreman_virt_who_configure_service_users, :organization_id, :integer ::ForemanVirtWhoConfigure::Config.find_each do |config| service_user = ::ForemanVirtWhoConfigure::ServiceUser.find_by(organization_id: config.organization_id) if service_user.present? config.update_columns(service_user_id: service_user.id) next end cfg_service_user = ::ForemanVirtWhoConfigure::ServiceUser.find_by(id: config.service_user_id) cfg_service_user.update_columns(organization_id: config.organization_id) end ::ForemanVirtWhoConfigure::ServiceUser.where(organization_id: nil).destroy_all end def down remove_column :foreman_virt_who_configure_service_users, :organization_id, :integer end end
Version data entries
6 entries across 6 versions & 1 rubygems