From a73e3d17f0d5bd1f0f9729995aeddc523b192169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20Gerardo=20Soto-Fortu=C3=B1o?= Date: Tue, 7 Nov 2023 08:58:09 -0500 Subject: [PATCH] Add type to assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Spencer Olson Reviewed-by: Jason Gillett Product-Review: Omar Soto-Fortuño Migration-Review: Cody Cutrer Tested-by: Service Cloud Jenkins --- .../20231107133109_add_type_to_assignments.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 db/migrate/20231107133109_add_type_to_assignments.rb diff --git a/db/migrate/20231107133109_add_type_to_assignments.rb b/db/migrate/20231107133109_add_type_to_assignments.rb new file mode 100644 index 00000000000..5ab1d555bca --- /dev/null +++ b/db/migrate/20231107133109_add_type_to_assignments.rb @@ -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 . +# + +class AddTypeToAssignments < ActiveRecord::Migration[7.0] + tag :predeploy + + def change + add_column :assignments, :type, :string, limit: 255, null: false, default: "Assignment" + end +end