Add type to assignments

closes VICE-3934
flag=none

test plan:
  - Specs pass.
  - Make sure you can run this migration locally
      by doing bundle exec rails db:migrate
  - Make sure you can rollback this migration locally
      by doing bundle exec rails db:migrate:down VERSION=20231107133109
  - After the migration is run, create assignments
      using new and create and make sure the type is Assignment:
         a1 = Assignment.create
         a2 = Assignment.new
      And verify a1.type and a2.type.
  - Verify that all your current assignments have Assignment as type:
      Assignment.where(type: "Assignment").count == Assignment.count

qa risk: low

Change-Id: Ic1afd53de81d449963ef4d27141c7d04c367264c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/332282
QA-Review: Spencer Olson <solson@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Omar Gerardo Soto-Fortuño 2023-11-07 08:58:09 -05:00 committed by Omar Soto-Fortuño
parent cd3ef89692
commit a73e3d17f0
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# frozen_string_literal: true
#
# Copyright (C) 2023 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
class AddTypeToAssignments < ActiveRecord::Migration[7.0]
tag :predeploy
def change
add_column :assignments, :type, :string, limit: 255, null: false, default: "Assignment"
end
end