change backfill migration to just drop/add the column with default instead
it's much faster with postgres >= 11 Change-Id: Iba90373eaf6622c7b0e048bf898a9eea0fa15ac6 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/260034 Reviewed-by: Rob Orton <rob@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
c40899dbd7
commit
7574f599bb
|
@ -17,16 +17,15 @@
|
|||
# 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 AddRedoRequestToSubmissions < ActiveRecord::Migration[5.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :submissions, :redo_request, :boolean
|
||||
change_column_default(:submissions, :redo_request, false)
|
||||
def up
|
||||
remove_column :submissions, :redo_request, if_exists: true
|
||||
add_column :submissions, :redo_request, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :submissions, :redo_request, :boolean
|
||||
change_column_null(:submissions, :redo_request, true)
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
# 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 BackfillSubmissionsRedoRequest < ActiveRecord::Migration[5.2]
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
DataFixup::BackfillNulls.run(Submission, :redo_request, default_value: false)
|
||||
change_column_null(:submissions, :redo_request, false)
|
||||
end
|
||||
|
||||
def down
|
||||
change_column_null(:submissions, :redo_request, true)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue