Sha256: 58a439b0826cc12e2db36b15e4743d78d3427d689e1e63d226690d1d083f6a85

Contents?: true

Size: 588 Bytes

Versions: 4

Compression:

Stored size: 588 Bytes

Contents

class AddOrganizationToSccAccount < ActiveRecord::Migration
  class SccAccount < ActiveRecord::Base
    belongs_to :organization
  end

  class Organization < ActiveRecord::Base
  end

  def up
    Organization.table_name = 'taxonomies'
    add_column :scc_accounts, :organization_id, :integer, null: true, index: true
    SccAccount.all.each do |a|
      a.organization = Organization.first
      a.save!
    end
    change_column :scc_accounts, :organization_id, :integer, null: false, index: true
  end

  def down
    remove_column :scc_accounts, :organization_id, :integer
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_scc_manager-1.1.3 db/migrate/20170303085304_add_organization_to_scc_account.rb
foreman_scc_manager-1.1.2 db/migrate/20170303085304_add_organization_to_scc_account.rb
foreman_scc_manager-1.0.1 db/migrate/20170303085304_add_organization_to_scc_account.rb
foreman_scc_manager-1.0.0 db/migrate/20170303085304_add_organization_to_scc_account.rb