part 4: change lookup_id and resource_link_id to UUID datatype

This is part 4 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links. We're removing
the old columns and add a not null constraint to the new columns.

refs INTEROP-6488
flag=none

test-plan:
* Before running the migration, you should create assignments with
  an external submission tool and persist the custom params, as we did
  here https://gerrit.instructure.com/c/canvas-lms/+/256029 to check
  later if everything is working fine;
* You should execute the migration and none errors should be raised;
* You should check if LTI is launching as expected in the assignments
  created before;
* You should check if the tool is saving the resource link properly for
  new assignments;

Change-Id: Ibfe43519462eaae88aee00de2ca307df111fc7d5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258268
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
This commit is contained in:
Wagner Gonçalves 2021-02-08 09:08:53 -03:00 committed by Wagner Goncalves
parent 4da7c8e29f
commit c836fea722
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
# Copyright (C) 2021 - 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 ChangeLookupUuidAndResourceLinkUuidToNotNullAtLtiResourceLinks < ActiveRecord::Migration[5.2]
tag :postdeploy
disable_ddl_transaction!
def change
change_column_null :lti_resource_links, :lookup_uuid, false
change_column_null :lti_resource_links, :resource_link_uuid, false
end
end

View File

@ -0,0 +1,30 @@
# frozen_string_literal: true
# Copyright (C) 2021 - 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 DropOldColumnsAtLtiResourceLinks < ActiveRecord::Migration[5.2]
tag :postdeploy
def up
remove_column :lti_resource_links, :lookup_id, :string, if_exists: true
remove_column :lti_resource_links, :resource_link_id, :string, if_exists: true
end
def down
raise ActiveRecord::IrreversibleMigration
end
end