Make ContextExternalTool.not_selectable be not nullable

Defaults to false

test plan:
- see if the not_selectable field on your most recent tool
  is nil. (It probably is already.)
  E.g, ContextExternalTool.not_selectable = nil
- take some other tool and set its not_selectable field to
  true. E.g. ContextExternalTool.first.not_selectable = true,
  then ContextExternalTool.first.save
- run this migration.
- Verify that ContextExternalTool.last.reload.not_selectable
  is now false instead of nil
- Verify that ContextExternalTool.first.reload.not_selectable
  is still true.
- You may want to set that first tool's not_selectable value
  back to false when you're done.

refs INTEROP-8558

flag = none

Change-Id: Ifde1bd866eee49bd4a8d0b82a70946b61a4717aa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/344273
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
Tucker McKnight 2024-04-02 12:34:57 -06:00 committed by Tucker Mcknight
parent 8bbfa761c6
commit 4d18531bc3
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# frozen_string_literal: true
#
# Canvas is Copyright (C) 2024 - 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 ContextExternalToolsNotSelectableDefaultFalse < ActiveRecord::Migration[7.0]
tag :predeploy
def change
change_column_default :context_external_tools, :not_selectable, from: nil, to: false
end
end

View File

@ -0,0 +1,30 @@
# frozen_string_literal: true
#
# Canvas is Copyright (C) 2024 - 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 ContextExternalToolsNotSelectableNotNull < ActiveRecord::Migration[7.0]
tag :postdeploy
disable_ddl_transaction!
def change
DataFixup::BackfillNulls.run(ContextExternalTool, :not_selectable, batch_size: 10_000)
change_column_null :context_external_tools, :not_selectable, false
end
end