Skip to content

Commit

Permalink
refactor: merge scorm feature migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed Oct 25, 2024
1 parent de4b33a commit 199f0d3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 39 deletions.
21 changes: 0 additions & 21 deletions db/migrate/20240322021829_add_scorm_config_to_task_def.rb

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions db/migrate/20240603020127_add_scorm_extensions.rb

This file was deleted.

24 changes: 24 additions & 0 deletions db/migrate/20241025050957_add_scorm_feat.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class AddScormFeat < ActiveRecord::Migration[7.1]
def change
# Record scorm extensions added to a task
add_column :tasks, :scorm_extensions, :integer, null: false, default: 0

change_table :task_definitions do |t|
t.boolean :scorm_enabled, default: false
t.boolean :scorm_allow_review, default: false
t.boolean :scorm_bypass_test, default: false
t.boolean :scorm_time_delay_enabled, default: false
t.integer :scorm_attempt_limit, default: 0
end

# Enable polymorphic relationships for task comments
remove_index :task_comments, :overseer_assessment_id

add_column :task_comments, :commentable_type, :string
rename_column :task_comments, :overseer_assessment_id, :commentable_id

TaskComment.where('NOT commentable_id IS NULL').in_batches.update_all(commentable_type: 'OverseerAssessment')

add_index :task_comments, [:commentable_type, :commentable_id]
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_07_01_221318) do
ActiveRecord::Schema[7.1].define(version: 2024_10_25_050957) do
create_table "activity_types", charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t|
t.string "name", null: false
t.string "abbreviation", null: false
Expand Down

0 comments on commit 199f0d3

Please sign in to comment.