Skip to content

Commit

Permalink
Add Rake task to migrate timeline events
Browse files Browse the repository at this point in the history
Since we're going to stop using the old_state and new_state fields and
instead rely on the existing old_value and new_value fields.
  • Loading branch information
thomasleese committed Sep 27, 2023
1 parent 5b3255e commit d14301a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/tasks/timeline_events.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace :timeline_events do
desc "Migrate old_state/new_state"
task migrate_old_new_state: :environment do
TimelineEvent
.where(event_type: %w[state_changed assessment_section_recorded])
.each do |timeline_event|
timeline_event.update!(
old_value: timeline_event.old_state,
new_value: timeline_event.new_state,
old_state: "",
new_state: "",
)
end
end
end

0 comments on commit d14301a

Please sign in to comment.