squash old migrations, p0

Change-Id: Id5846d2c21b01dcdc6877d8cb832cc34ac5f01ae
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/222648
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Simon Williams 2020-01-09 15:16:18 -06:00
parent 8e056707e5
commit 2e8bd8b9d9
31 changed files with 188 additions and 1078 deletions

View File

@ -0,0 +1,48 @@
#
# Copyright (C) 2020 - 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/>.
# ---
# We have started the process to squash migration files down to speed up
# local development/testing. This migration will run first and check if the
# migrations being squashed have been either fully or not-at-all applied, in
# which case it is safe to proceed, and otherwise throws an error.
#
# To squash more migrations, update the `last_squashed_migration_version` and
# bump the version in the filename of this migration so it runs again.
class ValidateMigrationIntegrity < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
initial_migration_version = "20101210192618"
last_squashed_migration_version = "20110409232339"
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?
if initial_migration_has_run && !last_squashed_migration_has_run
raise <<-ERROR
You are trying to upgrade from a too-old version of Canvas. Please
first upgrade to a version that includes database migration
#{last_squashed_migration_version}.
ERROR
end
end
def self.down
end
end

View File

@ -53,7 +53,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "log_in_url"
t.string "log_out_url"
t.string "identifier_format"
t.string "certificate_fingerprint"
t.text "certificate_fingerprint"
t.string "entity_id"
t.string "change_password_url"
t.string "login_handle_name"
@ -76,6 +76,19 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
end
create_table :account_notifications do |t|
t.string :subject
t.string :icon, :default => 'warning'
t.text :message
t.integer :account_id, :limit => 8
t.integer :user_id, :limit => 8
t.datetime :start_at
t.datetime :end_at
t.timestamps null: true
end
add_index :account_notifications, [:account_id, :start_at]
create_table "account_users", :force => true do |t|
t.integer "account_id", :limit => 8
t.integer "user_id", :limit => 8
@ -145,7 +158,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "assessment_question_banks", :force => true do |t|
t.integer "context_id", :limit => 8
t.string "context_type"
t.string "title"
t.text "title"
t.string "workflow_state"
t.datetime "deleted_at"
t.datetime "created_at"
@ -156,7 +169,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
add_index "assessment_question_banks", ["context_id", "context_type"], :name => "index_on_aqb_on_context_id_and_context_type"
create_table "assessment_questions", :force => true do |t|
t.string "name"
t.text "name"
t.text "question_data"
t.integer "context_id", :limit => 8
t.string "context_type"
@ -212,7 +225,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "action_level"
t.datetime "summarized_at"
t.float "interaction_seconds"
t.string "display_name"
t.text "display_name"
t.string "membership_type"
end
@ -296,6 +309,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "time_zone_edited"
t.boolean "turnitin_enabled"
t.string "allowed_extensions"
t.integer "needs_grading_count", :default => 0
end
add_index "assignments", ["assignment_group_id"], :name => "index_assignments_on_assignment_group_id"
@ -318,13 +332,13 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "attachments", :force => true do |t|
t.integer "context_id", :limit => 8
t.string "context_type"
t.integer "size"
t.integer "size", :limit => 8
t.integer "folder_id", :limit => 8
t.integer "enrollment_id", :limit => 8
t.string "content_type"
t.string "filename"
t.text "filename"
t.string "uuid"
t.string "display_name"
t.text "display_name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "scribd_mime_type_id", :limit => 8
@ -464,8 +478,22 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
end
add_index "communication_channels", ["path", "path_type"], :name => "index_communication_channels_on_path_and_path_type"
add_index "communication_channels", ["pseudonym_id"], :name => "index_communication_channels_on_pseudonym_id"
add_index "communication_channels", ["user_id"], :name => "index_communication_channels_on_user_id"
add_index "communication_channels", ["pseudonym_id", "position"]
add_index "communication_channels", ["user_id", "position"]
create_table :content_exports do |t|
t.integer :user_id, :limit => 8
t.integer :course_id, :limit => 8
t.integer :attachment_id, :limit => 8
t.string :export_type
t.text :settings
t.float :progress
t.string :workflow_state
t.timestamps null: true
end
add_index :content_exports, [:course_id]
add_index :content_exports, [:user_id]
create_table "content_migrations", :force => true do |t|
t.integer "context_id", :limit => 8
@ -482,6 +510,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.text "error_data"
t.integer "attachment_id", :limit => 8
t.integer "overview_attachment_id", :limit => 8
t.integer "exported_attachment_id", :limit => 8
end
create_table "content_tags", :force => true do |t|
@ -489,9 +518,9 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "content_type"
t.integer "context_id", :limit => 8
t.string "context_type"
t.string "title"
t.text "title"
t.string "tag"
t.string "url"
t.text "url"
t.datetime "created_at"
t.datetime "updated_at"
t.text "comments"
@ -516,6 +545,21 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
add_index "content_tags", ["context_module_id"], :name => "index_content_tags_on_context_module_id"
add_index "content_tags", ["workflow_state"], :name => "index_content_tags_on_workflow_state"
create_table :context_external_tools do |t|
t.integer :context_id, :limit => 8
t.string :context_type
t.string :domain
t.string :url
t.string :shared_secret
t.string :consumer_key
t.string :name
t.text :description
t.text :settings
t.string :workflow_state
t.timestamps null: true
end
create_table "context_message_participants", :force => true do |t|
t.integer "user_id", :limit => 8
t.integer "context_message_id", :limit => 8
@ -538,7 +582,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.text "recipients"
t.integer "root_context_message_id", :limit => 8
t.string "workflow_state"
t.string "viewed_user_ids"
t.text "viewed_user_ids"
t.string "context_code"
t.boolean "protect_recipients"
end
@ -565,7 +609,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "context_modules", :force => true do |t|
t.integer "context_id", :limit => 8
t.string "context_type"
t.string "name"
t.text "name"
t.integer "position"
t.text "prerequisites"
t.text "completion_requirements"
@ -630,6 +674,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.string "sis_name"
t.string "workflow_state", :default => "active"
t.boolean "restrict_enrollments_to_section_dates"
t.integer "account_id", :limit => 8
end
add_index "course_sections", ["abstract_course_id"], :name => "index_course_sections_on_abstract_course_id"
@ -682,6 +728,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.boolean "indexed"
t.string "sis_name"
t.string "sis_course_code"
t.boolean "restrict_enrollments_to_course_dates"
end
add_index "courses", ["abstract_course_id"], :name => "index_courses_on_abstract_course_id"
@ -726,7 +773,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.datetime "send_at"
t.string "link"
t.string "name_of_topic"
t.text "name_of_topic"
t.text "summary"
end
@ -801,6 +848,9 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "last_assignment_id", :limit => 8
t.integer "external_feed_id", :limit => 8
t.integer "editor_id", :limit => 8
t.boolean "podcast_enabled"
t.boolean "podcast_has_student_posts"
t.boolean "require_initial_post"
end
add_index "discussion_topics", ["attachment_id"], :name => "index_discussion_topics_on_attachment_id"
@ -839,6 +889,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.string "sis_name"
t.string "workflow_state", :default => "active"
t.boolean "ignore_term_date_restrictions"
end
add_index "enrollment_terms", ["root_account_id", "sis_source_id"], :name => "index_enrollment_terms_on_root_account_id_and_sis_source_id"
@ -923,15 +974,15 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "error_reports", :force => true do |t|
t.text "backtrace"
t.string "url"
t.string "message"
t.text "url"
t.text "message"
t.text "comments"
t.integer "user_id", :limit => 8
t.datetime "created_at"
t.datetime "updated_at"
t.string "email"
t.boolean "during_tests", :default => false
t.string "user_agent"
t.text "user_agent"
t.string "request_method"
t.text "http_env", :limit => 16777215
t.string "subject"
@ -1032,6 +1083,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "user_id", :limit => 8
t.integer "usage_count"
t.string "context_code"
t.string "workflow_state"
end
add_index "grading_standards", ["context_code"], :name => "index_grading_standards_on_context_code"
@ -1146,9 +1198,11 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "assessed_at"
t.string "title"
t.float "percent"
t.integer "associated_asset_id", :limit => 8
t.string "associated_asset_type"
end
add_index "learning_outcome_results", ["user_id", "content_tag_id"], :name => "index_learning_outcome_results_on_user_id_and_content_tag_id", :unique => true
add_index "learning_outcome_results", ["user_id", "content_tag_id", "associated_asset_id", "associated_asset_type"], :name => "index_learning_outcome_results_association", :unique => true
create_table "learning_outcomes", :force => true do |t|
t.integer "context_id", :limit => 8
@ -1205,18 +1259,20 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.integer "attachment_id", :limit => 8
t.integer "total_size"
t.string "old_media_id"
end
add_index "media_objects", ["attachment_id"], :name => "index_media_objects_on_attachment_id"
add_index "media_objects", ["context_id", "context_type"], :name => "index_media_objects_on_context_id_and_context_type"
add_index "media_objects", ["media_id"], :name => "index_media_objects_on_media_id"
add_index "media_objects", ["old_media_id"]
create_table "messages", :force => true do |t|
t.string "to"
t.string "from"
t.string "cc"
t.string "bcc"
t.string "subject"
t.text "subject"
t.text "body"
t.integer "delay_for", :default => 120
t.datetime "dispatch_at"
@ -1236,7 +1292,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "notification_name"
t.string "url"
t.string "path_type"
t.string "from_name"
t.text "from_name"
t.string "asset_context_code"
t.string "notification_category"
t.boolean "to_email"
@ -1270,7 +1326,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "name"
t.string "subject"
t.text "body"
t.string "sms_body"
t.text "sms_body"
t.string "category"
t.integer "delay_for", :default => 120
t.datetime "created_at"
@ -1328,7 +1384,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "request_id"
t.string "session_id"
t.integer "user_id", :limit => 8
t.string "url"
t.text "url"
t.integer "context_id", :limit => 8
t.string "context_type"
t.integer "asset_id", :limit => 8
@ -1342,7 +1398,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "developer_key_id", :limit => 8
t.boolean "user_request"
t.float "render_time"
t.string "user_agent"
t.text "user_agent"
t.integer "asset_user_access_id", :limit => 8
t.boolean "participated"
t.boolean "summarized"
@ -1350,7 +1406,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
end
execute("ALTER TABLE #{PageView.quoted_table_name} ADD PRIMARY KEY (request_id)")
add_index "page_views", ["account_id"], :name => "index_page_views_on_account_id"
add_index "page_views", ["account_id", "created_at"]
add_index "page_views", ["asset_user_access_id"], :name => "index_page_views_asset_user_access_id"
add_index "page_views", ["context_type", "context_id"], :name => "index_page_views_on_context_type_and_context_id"
add_index "page_views", ["summarized", "created_at"], :name => "index_page_views_summarized_created_at"
@ -1466,8 +1522,14 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "quiz_points_possible"
t.integer "extra_attempts"
t.string "temporary_user_code"
t.integer "extra_time"
t.boolean "manually_unlocked"
end
# If the column is created as a float with default 0, it becomes 0.0, which
# would be fine, but it's easier to compare schema consistency this way.
change_column :quiz_submissions, :fudge_points, :float
add_index "quiz_submissions", ["quiz_id", "user_id"], :name => "index_quiz_submissions_on_quiz_id_and_user_id", :unique => true
add_index "quiz_submissions", ["submission_id"], :name => "index_quiz_submissions_on_submission_id"
add_index "quiz_submissions", ["temporary_user_code"], :name => "index_quiz_submissions_on_temporary_user_code"
@ -1506,6 +1568,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.boolean "anonymous_submissions"
t.integer "assignment_group_id", :limit => 8
t.string "hide_results"
t.string "ip_filter"
t.boolean "require_lockdown_browser"
end
add_index "quizzes", ["assignment_id"], :name => "index_quizzes_on_assignment_id", :unique => true
@ -1708,6 +1772,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "context_code"
end
add_index "stream_item_instances", ["stream_item_id"]
create_table "stream_items", :force => true do |t|
t.integer "user_id", :limit => 8
t.string "context_code"
@ -1894,7 +1960,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.string "visible_inbox_types"
t.datetime "last_user_note"
t.boolean "subscribe_to_emails"
t.string "features_used"
t.text "features_used"
t.string "sis_name"
t.text "preferences"
t.string "avatar_state"
@ -1950,6 +2016,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "end_at"
t.string "context_code"
t.string "type"
t.text "settings"
end
add_index "web_conferences", ["context_id", "context_type"], :name => "index_web_conferences_on_context_id_and_context_type"
@ -1991,7 +2058,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "user_id", :limit => 8
t.datetime "created_at"
t.datetime "updated_at"
t.string "url"
t.text "url"
t.datetime "delayed_post_at"
t.boolean "protected_editing", :default => false
t.boolean "hide_from_students", :default => false
@ -2013,6 +2080,50 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "created_at"
t.datetime "updated_at"
end
create_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", :generated => true, :compatibility => 1).
on("enrollments").
after(:insert).
where("NEW.workflow_state = 'active'") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + 1
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", :generated => true, :compatibility => 1).
on("enrollments").
after(:update).
where("NEW.workflow_state <> OLD.workflow_state AND (NEW.workflow_state = 'active' OR OLD.workflow_state = 'active')") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN NEW.workflow_state = 'active' THEN 1 ELSE -1 END
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("submissions_after_update_row_tr", :generated => true, :compatibility => 1).
on("submissions").
after(:update) do |t|
t.where("( OLD.submission_type IS NOT NULL AND ( OLD.score IS NULL OR NOT OLD.grade_matches_current_submission OR OLD.workflow_state IN ('submitted', 'pending_review') ) ) <> ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) )") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) ) THEN 1 ELSE -1 END
WHERE id = NEW.assignment_id;
SQL_ACTIONS
end
end
end
def self.down

View File

@ -46,10 +46,13 @@ class CreateDelayedJobs < ActiveRecord::Migration[4.2]
table.string :locked_by
table.timestamps null: true
table.string :tag
end
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
add_index :delayed_jobs, [:queue], :name => 'delayed_jobs_queue'
add_index :delayed_jobs, [:tag]
end
def self.down

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 - 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 AddExtraTimeToQuizSubmissions < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :quiz_submissions, :extra_time, :integer
add_column :quiz_submissions, :manually_unlocked, :boolean
end
def self.down
remove_column :quiz_submissions, :extra_time
remove_column :quiz_submissions, :manually_unlocked
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AddIpFilterToQuizzes < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :quizzes, :ip_filter, :string
end
def self.down
remove_column :quizzes, :ip_filter
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AddAttachmentToContentMigration < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :content_migrations, :exported_attachment_id, :integer, :limit => 8
end
def self.down
remove_column :content_migrations, :exported_attachment_id
end
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 - 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 AddDelayedJobsTag < ActiveRecord::Migration[4.2]
tag :predeploy
def self.connection
Delayed::Backend::ActiveRecord::Job.connection
end
def self.up
add_column :delayed_jobs, :tag, :string
add_index :delayed_jobs, [:tag]
end
def self.down
remove_column :delayed_jobs, :tag
end
end

View File

@ -1,38 +0,0 @@
#
# Copyright (C) 2011 - 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 CreateAccountNotifications < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
create_table :account_notifications do |t|
t.string :subject
t.string :icon, :default => 'warning'
t.text :message
t.integer :account_id, :limit => 8
t.integer :user_id, :limit => 8
t.datetime :start_at
t.datetime :end_at
t.timestamps null: true
end
add_index :account_notifications, [:account_id, :start_at]
end
def self.down
drop_table :account_notifications
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 - 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 AddPodcastOptionsToDiscussionTopics < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :discussion_topics, :podcast_enabled, :boolean
add_column :discussion_topics, :podcast_has_student_posts, :boolean
end
def self.down
remove_column :discussion_topics, :podcast_enabled
remove_column :discussion_topics, :podcast_has_student_posts
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AddRequireInitialPostToDiscussionTopics < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :discussion_topics, :require_initial_post, :boolean
end
def self.down
remove_column :discussion_topics, :require_initial_post
end
end

View File

@ -1,32 +0,0 @@
#
# Copyright (C) 2011 - 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 AddRestrictionOptionsToCoursesAndSections < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :courses, :restrict_enrollments_to_course_dates, :boolean
add_column :course_sections, :restrict_enrollments_to_section_dates, :boolean
add_column :enrollment_terms, :ignore_term_date_restrictions, :boolean
end
def self.down
remove_column :courses, :restrict_enrollments_to_course_dates
remove_column :course_sections, :restrict_enrollments_to_section_dates
remove_column :enrollment_terms, :ignore_term_date_restrictions
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 ChangeFudgePointsToFloat < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :quiz_submissions, :fudge_points, :float
end
def self.down
change_column :quiz_submissions, :fudge_points, :integer
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 - 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 AddCrossListingInfo < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :course_sections, :account_id, :integer, :limit => 8
end
def self.down
remove_column :course_sections, :account_id
end
end

View File

@ -1,45 +0,0 @@
#
# Copyright (C) 2011 - 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 AddUngradedCountToAssignments < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :assignments, :needs_grading_count, :integer, :default => 0
update <<-SQL
UPDATE #{Assignment.quoted_table_name} SET needs_grading_count = COALESCE((
SELECT COUNT(*)
FROM #{Submission.quoted_table_name} s
INNER JOIN #{Enrollment.quoted_table_name} e ON e.user_id = s.user_id AND e.workflow_state = 'active'
WHERE s.assignment_id = assignments.id
AND e.course_id = assignments.context_id
AND (s.score IS NULL
OR NOT grade_matches_current_submission
OR s.workflow_state = 'submitted'
OR s.workflow_state = 'pending_review'
)
AND s.submission_type IS NOT NULL
AND s.workflow_state <> 'deleted'
), 0)
SQL
end
def self.down
remove_column :assignments, :needs_grading_count
end
end

View File

@ -1,41 +0,0 @@
#
# Copyright (C) 2011 - 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 CreateContextExternalTools < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
create_table :context_external_tools do |t|
t.integer :context_id, :limit => 8
t.string :context_type
t.string :domain
t.string :url
t.string :shared_secret
t.string :consumer_key
t.string :name
t.text :description
t.text :settings
t.string :workflow_state
t.timestamps null: true
end
end
def self.down
drop_table :context_external_tools
end
end

View File

@ -1,33 +0,0 @@
#
# Copyright (C) 2011 - 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 AddAssociatedAssetToLearningOutcomeResults < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :learning_outcome_results, :associated_asset_id, :integer, :limit => 8
add_column :learning_outcome_results, :associated_asset_type, :string
remove_index :learning_outcome_results, [:user_id, :content_tag_id]
add_index :learning_outcome_results, [:user_id, :content_tag_id, :associated_asset_id, :associated_asset_type], :unique => true, :name => "index_learning_outcome_results_association"
end
def self.down
# Not possible to reliably revert to the old index,
# which was only on user_id and content_tag_id
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 ChangeContextMessageViewedUserIdsSize < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :context_messages, :viewed_user_ids, :text
end
def self.down
change_column :context_messages, :viewed_user_ids, :string
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AddStreamItemInstancesIndex < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_index "stream_item_instances", ["stream_item_id"]
end
def self.down
remove_index "stream_item_instances", ["stream_item_id"]
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 - 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 AddCreatedAtToPageViewsIndex < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
remove_index :page_views, :column => :account_id
add_index :page_views, [ :account_id, :created_at ]
end
def self.down
remove_index :page_views, :column => [ :account_id, :created_at ]
add_index :page_views, :account_id
end
end

View File

@ -1,75 +0,0 @@
#
# Copyright (C) 2011 - 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/>.
# This migration was auto-generated via `rake db:generate_trigger_migration'.
# While you can edit this file, any changes you make to the definitions here
# will be undone by the next auto-generated trigger migration.
class UngradedCountTriggers < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
create_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", :generated => true).
on("enrollments").
after(:insert).
where("NEW.workflow_state = 'active'") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + 1
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", :generated => true).
on("enrollments").
after(:update).
where("NEW.workflow_state <> OLD.workflow_state AND (NEW.workflow_state = 'active' OR OLD.workflow_state = 'active')") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN NEW.workflow_state = 'active' THEN 1 ELSE -1 END
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("submissions_after_update_row_tr", :generated => true).
on("submissions").
after(:update) do |t|
t.where("( OLD.submission_type IS NOT NULL AND ( OLD.score IS NULL OR NOT OLD.grade_matches_current_submission OR OLD.workflow_state IN ('submitted', 'pending_review') ) ) <> ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) )") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) ) THEN 1 ELSE -1 END
WHERE id = NEW.assignment_id;
SQL_ACTIONS
end
end
end
def self.down
drop_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", "enrollments", :generated => true)
drop_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", "enrollments", :generated => true)
drop_trigger("submissions_after_update_row_tr", "submissions", :generated => true)
drop_trigger("submissions_after_update_row_when_old_submission_type_is_not_tr", "submissions", :generated => true)
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AddQuizRequireLockdownBrowser < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :quizzes, :require_lockdown_browser, :boolean
end
def self.down
remove_column :quizzes, :require_lockdown_browser
end
end

View File

@ -1,132 +0,0 @@
#
# Copyright (C) 2011 - 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/>.
# This migration was auto-generated via `rake db:generate_trigger_migration'.
# While you can edit this file, any changes you make to the definitions here
# will be undone by the next auto-generated trigger migration.
class UngradedCountTriggers2 < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
drop_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", "enrollments", :generated => true)
drop_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", "enrollments", :generated => true)
drop_trigger("submissions_after_update_row_tr", "submissions", :generated => true)
drop_trigger("submissions_after_update_row_when_old_submission_type_is_not_tr", "submissions", :generated => true)
create_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", :generated => true, :compatibility => 1).
on("enrollments").
after(:insert).
where("NEW.workflow_state = 'active'") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + 1
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", :generated => true, :compatibility => 1).
on("enrollments").
after(:update).
where("NEW.workflow_state <> OLD.workflow_state AND (NEW.workflow_state = 'active' OR OLD.workflow_state = 'active')") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN NEW.workflow_state = 'active' THEN 1 ELSE -1 END
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("submissions_after_update_row_tr", :generated => true, :compatibility => 1).
on("submissions").
after(:update) do |t|
t.where("( OLD.submission_type IS NOT NULL AND ( OLD.score IS NULL OR NOT OLD.grade_matches_current_submission OR OLD.workflow_state IN ('submitted', 'pending_review') ) ) <> ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) )") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) ) THEN 1 ELSE -1 END
WHERE id = NEW.assignment_id;
SQL_ACTIONS
end
end
end
def self.down
drop_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", "enrollments", :generated => true)
drop_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", "enrollments", :generated => true)
drop_trigger("submissions_after_update_row_tr", "submissions", :generated => true)
drop_trigger("submissions_after_update_row_when_old_submission_type_is_not_tr", "submissions", :generated => true)
create_trigger("enrollments_after_insert_row_when_new_workflow_state_active__tr", :generated => true, :compatibility => 0).
on("enrollments").
after(:insert).
where("NEW.workflow_state = 'active'") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + 1
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("enrollments_after_update_row_when_new_workflow_state_old_wor_tr", :generated => true, :compatibility => 0).
on("enrollments").
after(:update).
where("NEW.workflow_state <> OLD.workflow_state AND (NEW.workflow_state = 'active' OR OLD.workflow_state = 'active')") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN NEW.workflow_state = 'active' THEN 1 ELSE -1 END
WHERE id IN (SELECT assignment_id
FROM submissions
WHERE user_id = NEW.user_id
AND context_code = 'course_' || NEW.course_id
AND ( submissions.submission_type IS NOT NULL AND ( submissions.score IS NULL OR NOT submissions.grade_matches_current_submission OR submissions.workflow_state IN ('submitted', 'pending_review') ) )
);
SQL_ACTIONS
end
create_trigger("submissions_after_update_row_tr", :generated => true, :compatibility => 0).
on("submissions").
after(:update) do |t|
t.where("( OLD.submission_type IS NOT NULL AND ( OLD.score IS NULL OR NOT OLD.grade_matches_current_submission OR OLD.workflow_state IN ('submitted', 'pending_review') ) ) <> ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) )") do
<<-SQL_ACTIONS
UPDATE assignments
SET needs_grading_count = needs_grading_count + CASE WHEN ( NEW.submission_type IS NOT NULL AND ( NEW.score IS NULL OR NOT NEW.grade_matches_current_submission OR NEW.workflow_state IN ('submitted', 'pending_review') ) ) THEN 1 ELSE -1 END
WHERE id = NEW.assignment_id;
SQL_ACTIONS
end
end
end
end

View File

@ -1,36 +0,0 @@
#
# Copyright (C) 2011 - 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 AddPositionToCommunicationChannelIndexes < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
remove_index :communication_channels, :column => %w(user_id)
add_index :communication_channels, %w(user_id position)
remove_index :communication_channels, :column => %w(pseudonym_id)
add_index :communication_channels, %w(pseudonym_id position)
end
def self.down
remove_index :communication_channels, :column => %w(user_id position)
add_index :communication_channels, %w(user_id)
remove_index :communication_channels, :column => %w(pseudonym_id position)
add_index :communication_channels, %w(pseudonym_id)
end
end

View File

@ -1,34 +0,0 @@
#
# Copyright (C) 2011 - 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 StringColumnsToText < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :error_reports, :url, :text
change_column :error_reports, :message, :text
change_column :content_tags, :url, :text
change_column :page_views, :user_agent, :text
end
def self.down
change_column :error_reports, :url, :string
change_column :error_reports, :message, :string
change_column :content_tags, :url, :string
change_column :page_views, :user_agent, :string
end
end

View File

@ -1,30 +0,0 @@
#
# Copyright (C) 2011 - 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 PostgresCompatFixes < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :attachments, :size, :bigint
change_column :error_reports, :user_agent, :text
end
def self.down
change_column :attachments, :size, :integer
change_column :error_reports, :user_agent, :string
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 - 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 AddOldMediaIdToMediaComments < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :media_objects, :old_media_id, :string
add_index :media_objects, [:old_media_id]
end
def self.down
remove_column :media_objects, :old_media_id
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 AllowLongCertificateFingerprint < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :account_authorization_configs, :certificate_fingerprint, :text
end
def self.down
change_column :account_authorization_configs, :certificate_fingerprint, :string
end
end

View File

@ -1,54 +0,0 @@
#
# Copyright (C) 2011 - 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 VarcharsToText < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
change_column :assessment_question_banks, :title, :text
change_column :assessment_questions, :name, :text
change_column :asset_user_accesses, :display_name, :text
change_column :attachments, :display_name, :text
change_column :attachments, :filename, :text
change_column :content_tags, :title, :text
change_column :context_modules, :name, :text
change_column :delayed_messages, :name_of_topic, :text
change_column :messages, :from_name, :text
change_column :messages, :subject, :text
change_column :notifications, :sms_body, :text
change_column :page_views, :url, :text
change_column :users, :features_used, :text
change_column :wiki_pages, :url, :text
end
def self.down
change_column :assessment_question_banks, :title, :string
change_column :assessment_questions, :name, :string
change_column :asset_user_accesses, :display_name, :string
change_column :attachments, :display_name, :string
change_column :attachments, :filename, :string
change_column :content_tags, :title, :string
change_column :context_modules, :name, :string
change_column :delayed_messages, :name_of_topic, :string
change_column :messages, :from_name, :string
change_column :messages, :subject, :string
change_column :notifications, :sms_body, :string
change_column :page_views, :url, :string
change_column :users, :features_used, :string
change_column :wiki_pages, :url, :string
end
end

View File

@ -1,39 +0,0 @@
#
# Copyright (C) 2011 - 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 AddContentExport < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
create_table :content_exports do |t|
t.integer :user_id, :limit => 8
t.integer :course_id, :limit => 8
t.integer :attachment_id, :limit => 8
t.string :export_type
t.text :settings
t.float :progress
t.string :workflow_state
t.timestamps null: true
end
add_index :content_exports, [:course_id]
add_index :content_exports, [:user_id]
end
def self.down
drop_table :content_exports
end
end

View File

@ -1,28 +0,0 @@
#
# Copyright (C) 2011 - 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 WebConferenceSettings < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :web_conferences, :settings, :text
end
def self.down
remove_column :web_conferences, :settings
end
end

View File

@ -1,29 +0,0 @@
#
# Copyright (C) 2011 - 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 AddWorkflowStateToGradingStandards < ActiveRecord::Migration[4.2]
tag :predeploy
def self.up
add_column :grading_standards, :workflow_state, :string
GradingStandard.update_all(:workflow_state => 'active')
end
def self.down
remove_column :grading_standards, :workflow_state
end
end