squash old migrations, p29
Change-Id: I14eb45f796dfdf102f37b1aeb9ad664ab593465b Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236781 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Ethan Vizitei <evizitei@instructure.com> QA-Review: Ethan Vizitei <evizitei@instructure.com> Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
parent
57ed77011a
commit
a72e6cd4fd
|
@ -180,14 +180,6 @@ class EnrollmentState < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def self.build_states_in_ranges
|
||||
Enrollment.find_ids_in_ranges(:batch_size => 250) do |min_id, max_id|
|
||||
enrollments = Enrollment.joins("LEFT OUTER JOIN #{EnrollmentState.quoted_table_name} ON enrollment_states.enrollment_id = enrollments.id").
|
||||
where("enrollment_states IS NULL").where(:id => min_id..max_id).to_a
|
||||
enrollments.each(&:create_enrollment_state)
|
||||
end
|
||||
end
|
||||
|
||||
def self.process_term_states_in_ranges(start_at, end_at, term, enrollment_type=nil)
|
||||
scope = term.enrollments
|
||||
scope = scope.where(:type => enrollment_type) if enrollment_type
|
||||
|
|
|
@ -28,7 +28,7 @@ class ValidateMigrationIntegrity < ActiveRecord::Migration[4.2]
|
|||
|
||||
def self.up
|
||||
initial_migration_version = "20101210192618"
|
||||
last_squashed_migration_version = "20160322204834"
|
||||
last_squashed_migration_version = "20160523163311"
|
||||
|
||||
initial_migration_has_run = ActiveRecord::SchemaMigration.where(version: initial_migration_version).exists?
|
||||
last_squashed_migration_has_run = ActiveRecord::SchemaMigration.where(version: last_squashed_migration_version).exists?
|
|
@ -98,10 +98,13 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.boolean "parent_registration", default: false, null: false
|
||||
t.string "workflow_state", default: "active", null: false
|
||||
t.boolean "jit_provisioning", default: false, null: false
|
||||
t.string "metadata_uri"
|
||||
t.json "settings", default: {}, null: false
|
||||
end
|
||||
|
||||
add_index "account_authorization_configs", ["account_id"], :name => "index_account_authorization_configs_on_account_id"
|
||||
add_index :account_authorization_configs, :workflow_state
|
||||
add_index :account_authorization_configs, :metadata_uri, where: "metadata_uri IS NOT NULL"
|
||||
|
||||
create_table "account_reports" do |t|
|
||||
t.integer "user_id", :limit => 8, :null => false
|
||||
|
@ -193,6 +196,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.string "integration_id"
|
||||
t.string "lti_context_id"
|
||||
t.string "brand_config_md5", limit: 32
|
||||
t.string "turnitin_originality"
|
||||
end
|
||||
|
||||
add_index "accounts", ["name", "parent_account_id"], :name => "index_accounts_on_name_and_parent_account_id"
|
||||
|
@ -360,6 +364,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.integer "cloned_item_id", :limit => 8
|
||||
t.string "context_code"
|
||||
t.string "migration_id"
|
||||
t.string "sis_source_id"
|
||||
end
|
||||
|
||||
add_index "assignment_groups", ["context_id", "context_type"], :name => "index_assignment_groups_on_context_id_and_context_type"
|
||||
|
@ -466,6 +471,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.integer "turnitin_id", limit: 8
|
||||
t.boolean "moderated_grading"
|
||||
t.datetime "grades_published_at"
|
||||
t.boolean "omit_from_final_grade"
|
||||
end
|
||||
|
||||
add_index "assignments", ["assignment_group_id"], :name => "index_assignments_on_assignment_group_id"
|
||||
|
@ -1147,7 +1153,6 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.integer "user_id", :limit => 8
|
||||
t.string "name"
|
||||
t.string "redirect_uri"
|
||||
t.string "tool_id"
|
||||
t.string "icon_url"
|
||||
t.string "sns_arn"
|
||||
t.boolean "trusted"
|
||||
|
@ -1155,8 +1160,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.string "workflow_state", default: "active", null: false
|
||||
t.boolean "replace_tokens"
|
||||
t.boolean "auto_expire_tokens"
|
||||
t.string "redirect_uris", array: true, default: [], null: false
|
||||
end
|
||||
add_index :developer_keys, [:tool_id], :unique => true
|
||||
|
||||
create_table "discussion_entries", :force => true do |t|
|
||||
t.text "message"
|
||||
|
@ -1276,6 +1281,31 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
add_index :enrollment_dates_overrides, :enrollment_term_id
|
||||
|
||||
create_table :enrollment_states, :id => false do |t|
|
||||
t.integer :enrollment_id, limit: 8, null: false
|
||||
|
||||
t.string :state
|
||||
t.boolean :state_is_current, null: false, default: false
|
||||
t.datetime :state_started_at
|
||||
t.datetime :state_valid_until
|
||||
|
||||
t.boolean :restricted_access, null: false, default: false
|
||||
t.boolean :access_is_current, null: false, default: false
|
||||
|
||||
# these will go away - for initial diagnostic purposes
|
||||
t.datetime :state_invalidated_at
|
||||
t.datetime :state_recalculated_at
|
||||
t.datetime :access_invalidated_at
|
||||
t.datetime :access_recalculated_at
|
||||
end
|
||||
|
||||
add_index :enrollment_states, :enrollment_id, :unique => true, :name => "index_enrollment_states"
|
||||
execute("ALTER TABLE #{EnrollmentState.quoted_table_name} ADD CONSTRAINT enrollment_states_pkey PRIMARY KEY USING INDEX index_enrollment_states")
|
||||
|
||||
add_index :enrollment_states, :state
|
||||
add_index :enrollment_states, [:state_is_current, :access_is_current], :name => "index_enrollment_states_on_currents"
|
||||
add_index :enrollment_states, :state_valid_until
|
||||
|
||||
create_table "enrollment_terms", :force => true do |t|
|
||||
t.integer "root_account_id", :limit => 8, :null => false
|
||||
t.string "name"
|
||||
|
@ -1291,6 +1321,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.string "workflow_state", :default => "active", :null => false
|
||||
t.text "stuck_sis_fields"
|
||||
t.string "integration_id"
|
||||
t.integer "grading_period_group_id", limit: 8
|
||||
end
|
||||
|
||||
add_index :enrollment_terms, [:sis_source_id, :root_account_id], where: "sis_source_id IS NOT NULL", unique: true
|
||||
|
@ -1300,6 +1331,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
name: "index_terms_on_integration_id",
|
||||
where: "integration_id IS NOT NULL"
|
||||
add_index :enrollment_terms, :sis_batch_id, where: "sis_batch_id IS NOT NULL"
|
||||
add_index :enrollment_terms, :grading_period_group_id
|
||||
|
||||
create_table "enrollments", :force => true do |t|
|
||||
t.integer "user_id", :limit => 8, :null => false
|
||||
|
@ -1310,7 +1342,6 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "associated_user_id", :limit => 8
|
||||
t.string "sis_source_id"
|
||||
t.integer "sis_batch_id", :limit => 8
|
||||
t.datetime "start_at"
|
||||
t.datetime "end_at"
|
||||
|
@ -1526,12 +1557,14 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.datetime "last_unlock_at"
|
||||
t.integer "cloned_item_id", :limit => 8
|
||||
t.integer "position"
|
||||
t.string "submission_context_code"
|
||||
end
|
||||
|
||||
add_index "folders", ["cloned_item_id"], :name => "index_folders_on_cloned_item_id"
|
||||
add_index "folders", ["context_id", "context_type"], :name => "index_folders_on_context_id_and_context_type"
|
||||
add_index "folders", ["parent_folder_id"], :name => "index_folders_on_parent_folder_id"
|
||||
add_index :folders, [:context_id, :context_type], :unique => true, :name => 'index_folders_on_context_id_and_context_type_for_root_folders', :where => "parent_folder_id IS NULL AND workflow_state<>'deleted'"
|
||||
add_index :folders, [:submission_context_code, :parent_folder_id], unique: true
|
||||
|
||||
create_table :gradebook_csvs do |t|
|
||||
t.integer :user_id, limit: 8, null: false
|
||||
|
@ -1570,6 +1603,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.integer :account_id, :limit => 8
|
||||
t.timestamps null: true
|
||||
t.string :workflow_state, default: "active", null: false
|
||||
t.string :title
|
||||
end
|
||||
add_index :grading_period_groups, :course_id
|
||||
add_index :grading_period_groups, :account_id
|
||||
|
@ -1652,6 +1686,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.text "description"
|
||||
t.integer "avatar_attachment_id", :limit => 8
|
||||
t.integer "leader_id", :limit => 8
|
||||
t.string "lti_context_id"
|
||||
end
|
||||
|
||||
add_index "groups", ["account_id"], :name => "index_groups_on_account_id"
|
||||
|
@ -1686,24 +1721,6 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
end
|
||||
add_index :ignores, [:asset_id, :asset_type, :user_id, :purpose], :unique => true, :name => 'index_ignores_on_asset_and_user_id_and_purpose'
|
||||
|
||||
create_table "inbox_items", :force => true do |t|
|
||||
t.integer "user_id", :limit => 8
|
||||
t.integer "sender_id", :limit => 8
|
||||
t.integer "asset_id", :limit => 8
|
||||
t.string "subject"
|
||||
t.string "body_teaser"
|
||||
t.string "asset_type"
|
||||
t.string "workflow_state"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "context_code"
|
||||
end
|
||||
|
||||
add_index "inbox_items", ["sender_id"], :name => "index_inbox_items_on_sender_id"
|
||||
add_index "inbox_items", ["user_id"], :name => "index_inbox_items_on_user_id"
|
||||
add_index "inbox_items", ["workflow_state"], :name => "index_inbox_items_on_workflow_state"
|
||||
add_index :inbox_items, [:asset_type, :asset_id]
|
||||
|
||||
create_table "learning_outcome_groups", :force => true do |t|
|
||||
t.integer "context_id", :limit => 8
|
||||
t.string "context_type"
|
||||
|
@ -2683,6 +2700,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
|
||||
add_index "submission_comment_participants", ["submission_comment_id"], :name => "index_submission_comment_participants_on_submission_comment_id"
|
||||
add_index "submission_comment_participants", ["user_id"], :name => "index_submission_comment_participants_on_user_id"
|
||||
add_index :submission_comment_participants, [:user_id, :participation_type], name: 'index_scp_on_user_id_and_participation_type'
|
||||
|
||||
create_table "submission_comments", :force => true do |t|
|
||||
t.text "comment"
|
||||
|
@ -2703,11 +2721,13 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.boolean "teacher_only_comment", :default => false
|
||||
t.boolean "hidden", :default => false
|
||||
t.integer "provisional_grade_id", limit: 8
|
||||
t.boolean "draft", default: false
|
||||
end
|
||||
|
||||
add_index "submission_comments", ["author_id"], :name => "index_submission_comments_on_author_id"
|
||||
add_index "submission_comments", ["context_id", "context_type"], :name => "index_submission_comments_on_context_id_and_context_type"
|
||||
add_index "submission_comments", ["submission_id"], :name => "index_submission_comments_on_submission_id"
|
||||
add_index :submission_comments, :draft
|
||||
|
||||
create_table :submission_versions do |t|
|
||||
t.integer "context_id", :limit => 8
|
||||
|
@ -2851,10 +2871,13 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.integer :user_id, :limit => 8, :null => false
|
||||
t.integer :observer_id, :limit => 8, :null => false
|
||||
t.string :workflow_state, default: 'active', null: false
|
||||
t.timestamps null: true
|
||||
t.integer :sis_batch_id, limit: 8
|
||||
end
|
||||
add_index :user_observers, [:user_id, :observer_id], :unique => true
|
||||
add_index :user_observers, :observer_id
|
||||
add_index :user_observers, :workflow_state
|
||||
add_index :user_observers, :sis_batch_id, where: "sis_batch_id IS NOT NULL"
|
||||
|
||||
create_table "user_services", :force => true do |t|
|
||||
t.integer "user_id", :limit => 8, :null => false
|
||||
|
@ -2899,7 +2922,6 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
t.boolean "show_user_services", :default => true
|
||||
t.string "gender"
|
||||
t.integer "page_views_count", :default => 0
|
||||
t.integer "unread_inbox_items_count"
|
||||
t.integer "reminder_time_for_due_dates", :default => 172800
|
||||
t.integer "reminder_time_for_grading", :default => 0
|
||||
t.integer "storage_quota", :limit => 8
|
||||
|
@ -3264,7 +3286,9 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
|
|||
add_foreign_key :discussion_topics, :users
|
||||
add_foreign_key :discussion_topics, :users, column: :editor_id
|
||||
add_foreign_key :enrollment_dates_overrides, :enrollment_terms
|
||||
add_foreign_key :enrollment_states, :enrollments
|
||||
add_foreign_key :enrollment_terms, :accounts, :column => :root_account_id
|
||||
add_foreign_key :enrollment_terms, :grading_period_groups
|
||||
add_foreign_key :enrollment_terms, :sis_batches
|
||||
add_foreign_key :enrollments, :accounts, :column => :root_account_id
|
||||
add_foreign_key :enrollments, :course_sections
|
||||
|
|
|
@ -82,7 +82,9 @@ class AddAuthenticationAuditorTables < ActiveRecord::Migration[4.2]
|
|||
event_type text,
|
||||
grade_before text,
|
||||
grade_after text,
|
||||
graded_anonymously boolean
|
||||
graded_anonymously boolean,
|
||||
excused_before boolean,
|
||||
excused_after boolean
|
||||
) #{compression_params}}
|
||||
|
||||
indexes.each do |index_name|
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 DropInboxItems < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
remove_column :users, :unread_inbox_items_count
|
||||
drop_table :inbox_items
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :users, :unread_inbox_items_count, :integer
|
||||
|
||||
create_table "inbox_items" do |t|
|
||||
t.integer "user_id", :limit => 8
|
||||
t.integer "sender_id", :limit => 8
|
||||
t.integer "asset_id", :limit => 8
|
||||
t.string "subject"
|
||||
t.string "body_teaser"
|
||||
t.string "asset_type"
|
||||
t.string "workflow_state"
|
||||
t.boolean "sender"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "context_code"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddDraftToSubmissionComments < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def up
|
||||
add_column :submission_comments, :draft, :boolean
|
||||
|
||||
change_column_default :submission_comments, :draft, false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :submission_comments, :draft
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddNotInFinalGradeToAssignments < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :assignments, :omit_from_final_grade, :boolean
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddMetadataUriToAuthenticationProviders < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :account_authorization_configs, :metadata_uri, :string
|
||||
add_index :account_authorization_configs, :metadata_uri, where: "metadata_uri IS NOT NULL"
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddRedirectUrisToDeveloperKeys < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :developer_keys, :redirect_uris, :string, array: true, default: [], null: false
|
||||
|
||||
DeveloperKey.all.find_each do |dk|
|
||||
next unless dk.redirect_uri
|
||||
dk.redirect_uris = [dk.redirect_uri]
|
||||
dk.save!
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddIndexOnSubmissionCommentParticipants < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :submission_comment_participants, [:user_id, :participation_type],
|
||||
algorithm: :concurrently,
|
||||
name: 'index_scp_on_user_id_and_participation_type'
|
||||
end
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddCassandraGradeChangeExcused < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
include Canvas::Cassandra::Migration
|
||||
|
||||
def self.cassandra_cluster
|
||||
'auditors'
|
||||
end
|
||||
|
||||
def self.up
|
||||
cassandra.execute %{ ALTER TABLE grade_changes ADD excused_before boolean; }
|
||||
cassandra.execute %{ ALTER TABLE grade_changes ADD excused_after boolean; }
|
||||
end
|
||||
|
||||
def self.down
|
||||
cassandra.execute %{ ALTER TABLE grade_changes DROP excused_before; }
|
||||
cassandra.execute %{ ALTER TABLE grade_changes DROP excused_after; }
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddLtiContextIdToGroups < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :groups, :lti_context_id, :string
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 DropDevKeyToolId < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
remove_column :developer_keys, :tool_id
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :developer_keys, :tool_id, :string
|
||||
add_index :developer_keys, [:tool_id], unique: true
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddSubmissionContextCodeToFolders < ActiveRecord::Migration[4.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :folders, :submission_context_code, :string
|
||||
add_index :folders, [:submission_context_code, :parent_folder_id], unique: true, algorithm: :concurrently
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddTimestampsToUserObserver < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
change_table :user_observers do |t|
|
||||
t.timestamps null: true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddIndexToSubmissionCommentDraft < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
add_index :submission_comments, :draft, algorithm: :concurrently
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 PopulateSubmissionCommentDraftField < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def self.up
|
||||
DataFixup::PopulateSubmissionCommentDraftField.send_later_if_production_enqueue_args(
|
||||
:run,
|
||||
priority: Delayed::LOW_PRIORITY,
|
||||
strand: "populate_submission_comment_draft_field_fixup_#{Shard.current.database_server.id}",
|
||||
max_attempts: 1
|
||||
)
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 DropSisSourceIdFromEnrollment < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def change
|
||||
remove_column :enrollments, :sis_source_id, :string
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddGradingPeriodGroupIdToEnrollmentTerm < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def up
|
||||
add_column :enrollment_terms, :grading_period_group_id, :integer, :limit => 8
|
||||
add_index :enrollment_terms, :grading_period_group_id
|
||||
add_foreign_key :enrollment_terms, :grading_period_groups
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :enrollment_terms, :grading_period_group_id
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddSisBatchIdToUserObservers < ActiveRecord::Migration[4.2]
|
||||
disable_ddl_transaction!
|
||||
tag :predeploy
|
||||
def change
|
||||
add_column :user_observers, :sis_batch_id, :integer, limit: 8
|
||||
add_index :user_observers, :sis_batch_id, where: "sis_batch_id IS NOT NULL", algorithm: :concurrently
|
||||
end
|
||||
end
|
|
@ -1,53 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 CreateEnrollmentStates < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def up
|
||||
create_table :enrollment_states, :id => false do |t|
|
||||
t.integer :enrollment_id, limit: 8, null: false
|
||||
|
||||
t.string :state
|
||||
t.boolean :state_is_current, null: false, default: false
|
||||
t.datetime :state_started_at
|
||||
t.datetime :state_valid_until
|
||||
|
||||
t.boolean :restricted_access, null: false, default: false
|
||||
t.boolean :access_is_current, null: false, default: false
|
||||
|
||||
# these will go away - for initial diagnostic purposes
|
||||
t.datetime :state_invalidated_at
|
||||
t.datetime :state_recalculated_at
|
||||
t.datetime :access_invalidated_at
|
||||
t.datetime :access_recalculated_at
|
||||
end
|
||||
|
||||
add_index :enrollment_states, :enrollment_id, :unique => true, :name => "index_enrollment_states"
|
||||
execute("ALTER TABLE #{EnrollmentState.quoted_table_name} ADD CONSTRAINT enrollment_states_pkey PRIMARY KEY USING INDEX index_enrollment_states")
|
||||
|
||||
add_index :enrollment_states, :state
|
||||
add_index :enrollment_states, [:state_is_current, :access_is_current], :name => "index_enrollment_states_on_currents"
|
||||
add_index :enrollment_states, :state_valid_until
|
||||
|
||||
add_foreign_key :enrollment_states, :enrollments
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :enrollment_states
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 MultipleGradingPeriodsDataMigration < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::MultipleGradingPeriodsDataMigration.send_later_if_production_enqueue_args(
|
||||
:run,
|
||||
priority: Delayed::LOW_PRIORITY,
|
||||
strand: "multiple_grading_periods_data_migration",
|
||||
max_attempts: 1
|
||||
)
|
||||
end
|
||||
|
||||
def self.down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -1,27 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 BuildEnrollmentStates < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def up
|
||||
EnrollmentState.build_states_in_ranges
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddTitleToGradingPeriodGroups < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def self.up
|
||||
add_column :grading_period_groups, :title, :string
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :grading_period_groups, :title
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddSisSourceIdToAssignmentGroup < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :assignment_groups, :sis_source_id, :string
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddTurnitinOriginalityToAccounts < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :accounts, :turnitin_originality, :string
|
||||
end
|
||||
end
|
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 MigrateVersionsToPartitions < ActiveRecord::Migration[4.2]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::MigrateVersionsToPartitions.send_later_if_production_enqueue_args(:run,
|
||||
priority: Delayed::LOWER_PRIORITY,
|
||||
max_attempts: 1,
|
||||
strand: "partition_versions:#{Shard.current.database_server.id}")
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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 AddSettingsToAuthenticationProviders < ActiveRecord::Migration[4.2]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :account_authorization_configs, :settings, :json, default: {}, null: false
|
||||
end
|
||||
end
|
|
@ -1,24 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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/>.
|
||||
|
||||
module DataFixup::MigrateVersionsToPartitions
|
||||
def self.run
|
||||
partman = CanvasPartman::PartitionManager.create(Version)
|
||||
|
||||
partman.migrate_data_to_partitions
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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/>.
|
||||
|
||||
module DataFixup::MultipleGradingPeriodsDataMigration
|
||||
def self.run
|
||||
DataFixup::ReassociateGradingPeriodGroups.run
|
||||
DataFixup::MoveSubAccountGradingPeriodsToCourses.run
|
||||
end
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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/>.
|
||||
|
||||
module DataFixup::PopulateSubmissionCommentDraftField
|
||||
def self.run
|
||||
relevant_comments = SubmissionComment.where(draft: nil)
|
||||
|
||||
SubmissionComment.find_ids_in_ranges do |min_id, max_id|
|
||||
relevant_comments.where(:id => min_id..max_id).update_all(draft: false)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,45 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 - 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/>.
|
||||
|
||||
require 'spec_helper'
|
||||
require 'db/migrate/20160517153405_build_enrollment_states.rb'
|
||||
|
||||
describe 'BuildEnrollmentStates' do
|
||||
describe "up" do
|
||||
it "should populate all enrollments with enrollment states" do
|
||||
# turns out i broke the old migration - oops
|
||||
BuildEnrollmentStates.new.down
|
||||
|
||||
course_with_student(:active_all => true)
|
||||
|
||||
expect(@course.enrollments.count).to eq 2
|
||||
|
||||
EnrollmentState.where(:enrollment_id => @course.enrollments.map(&:id)).delete_all
|
||||
@course.enrollments.reload
|
||||
@course.enrollments.each do |e|
|
||||
expect(e.association(:enrollment_state).target).to be_blank
|
||||
end
|
||||
|
||||
BuildEnrollmentStates.new.up
|
||||
|
||||
@course.enrollments.reload
|
||||
@course.enrollments.each do |e|
|
||||
expect(e.enrollment_state).to be_present
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue