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