Sha256: a69ee5d7ad74d52b5d376c2dbe03214e854b5558872f61dbb05b5047876fdb11

Contents?: true

Size: 640 Bytes

Versions: 14

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

# Add organization to app instance
class AddOrganizationToAppInstance < ActiveRecord::Migration[6.0]
  # FakeAppInstance, because of 'validates :location'
  class AppInstance < ApplicationRecord
    belongs_to :organization
  end

  def up
    add_column :app_instances, :organization_id, :integer, :null => true, :index => true
    AppInstance.all.each do |a|
      a.organization = ::Organization.first
      a.save!
    end
    change_column :app_instances, :organization_id, :integer, :null => false, :index => true
  end

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
foreman_acd-0.11.0 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.10.0 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.7 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.5 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.4 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.3 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.2.3 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.2.2 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.2.1 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.2 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.1 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.9.0 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.7.0 db/migrate/20210112111548_add_organization_to_app_instance.rb
foreman_acd-0.6.0 db/migrate/20210112111548_add_organization_to_app_instance.rb