Skip to content

Commit

Permalink
Chore: Add example data migration
Browse files Browse the repository at this point in the history
Because:
- When I need to write a new data migration, I want to have an example migration I can reference and use to copy/paste the boilerplate.
  • Loading branch information
KevinMulhern committed Aug 26, 2024
1 parent b1015f6 commit 8d27743
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/tasks/data_migrations/example.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# create new data migration rake task file and copy the contents of this file into it
#
# namespace :data_migrations do
#
# desc "<What will this task do?>"
# task example_data_migration_name: :environment do
# puts "Processing #{Lesson.count} lessons"
#
# progressbar = ProgressBar.create(total: Lesson.count, format: '%t: |%w%i| Completed: %c %a %e')
#
# Lesson.find_each do |lesson|
# begin
# # do something
# rescue StandardError => e
# progressbar.log "There was an error with lesson ##{lesson.id}: #{e.message}"
# ensure
# progressbar.increment
# end
# end
# end
# end

0 comments on commit 8d27743

Please sign in to comment.