Backfill values without using a job

closes OUT-2178

test plan:
  - run on your test environment and confirm no migration errors:
    * docker-compose run --rm web bundle exec rake db:drop RAILS_ENV=test
    * docker-compose run --rm web bundle exec rake db:create RAILS_ENV=test
    * docker-compose run --rm web bundle exec rake db:migrate RAILS_ENV=test

Change-Id: I08ae607ae0c6ad48a7990a56dce2e0041c229c30
Reviewed-on: https://gerrit.instructure.com/151889
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Frank Murphy <fmurphy@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
This commit is contained in:
Augusto Callejas 2018-05-30 06:42:52 -10:00
parent 10f1413dea
commit 26c29259fe
4 changed files with 57 additions and 17 deletions

View File

@ -18,15 +18,9 @@
class BackfillHidePointsToRubricAssessments < ActiveRecord::Migration[5.1]
tag :postdeploy
disable_ddl_transaction!
def up
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
:run,
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
RubricAssessment,
{
hide_points: false
}
)
DataFixup::BackfillNulls.run(RubricAssessment, :hide_points, default_value: false)
end
end

View File

@ -18,16 +18,9 @@
class BackfillHidePointsAndHiddenToLearningOutcomeResults < ActiveRecord::Migration[5.1]
tag :postdeploy
disable_ddl_transaction!
def up
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
:run,
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
LearningOutcomeResult,
{
hide_points: false,
hidden: false
}
)
DataFixup::BackfillNulls.run(LearningOutcomeResult, [:hide_points, :hidden], default_value: false)
end
end

View File

@ -0,0 +1,26 @@
#
# Copyright (C) 2018 - 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 MakeRubricAssessmentHidePointsNotNull < ActiveRecord::Migration[5.1]
tag :postdeploy
disable_ddl_transaction!
def change
change_column_null :rubric_assessments, :hide_points, false
end
end

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2018 - 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 MakeLearningOutcomeResultHidePointsAndHiddenNotNull < ActiveRecord::Migration[5.1]
tag :postdeploy
disable_ddl_transaction!
def change
change_column_null :learning_outcome_results, :hide_points, false
change_column_null :learning_outcome_results, :hidden, false
end
end