A platform for community discussion. Free, open, simple.
DEV: Add an `after_copy_data` hook to CopyStep (#34491)
Selase Krakanic3c62165fb9d
diff --git a/migrations/lib/importer/copy_step.rb b/migrations/lib/importer/copy_step.rbindex 8e118542023..356d9889e3f 100644--- a/migrations/lib/importer/copy_step.rb+++ b/migrations/lib/importer/copy_step.rb@@ -66,10 +66,24 @@ module Migrations::Importerdef executesuper++ before(total_rows: total_count)with_progressbar(total_count) { copy_data }+ after(total_rows: total_count)+nilend+ protected++ def before(total_rows:)+ # Override in step implementation if needed+ end++ def after(total_rows:)+ # Override in step implementation if needed+ end+privatedef copy_data@@ -165,8 +179,11 @@ module Migrations::Importerenddef total_count- query, parameters = self.class.total_rows_query- @intermediate_db.count(query, *parameters)+ @total_count ||=+ begin+ query, parameters = self.class.total_rows_query+ @intermediate_db.count(query, *parameters)+ endendendend