#
# Copyright (C) 2020 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify
# the terms of the GNU Affero General Public License as publishe
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but 
# WARRANTY; without even the implied warranty of MERCHANTABILITY
# A PARTICULAR PURPOSE. See the GNU Affero General Public Licens
# details.
#
# You should have received a copy of the GNU Affero General Publ
# with this program. If not, see <http://www.gnu.org/licenses/>.

class AddRootAccountIdToRubricAssociations < ActiveRecord::Migration[5.2]
  include MigrationHelpers::AddColumnAndFk

  tag :predeploy
  disable_ddl_transaction!

  def up
    add_column_and_fk :rubric_associations, :root_account_id, :accounts
    add_index :rubric_associations, :root_account_id, algorithm: :concurrently
  end

  def down
    remove_column :rubric_associations, :root_account_id
  end
end

Add root account to rubric associations
Add root account to rubric associations

Closes PLAT-5575
flag=none

Test Plan:
- Verify migrations run
- Verify a root_account_id can be set on a RubricAssociation record

Change-Id: I5dfe80ccd1cd3f0a2cc42f9411d860ef5f77034a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/229765
Tested-by: Service Cloud Jenkins <9144042a601061f88f1e1d7a1753ea3e2972119d@instructure.com>
QA-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com>
Product-Review: Weston Dransfield <e9203059795dc94e28a8831c65eb7869e818825e@instructure.com>
Reviewed-by: Clint Furse <b31c824c483447b2438702c2da6f729b3ebb9b50@instructure.com>
Reviewed-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
