diff --git a/db/migrate/20241123001206_add_unique_index_to_relationships_table.rb b/db/migrate/20241123001206_add_unique_index_to_relationships_table.rb index 28e170005..e8e83818c 100644 --- a/db/migrate/20241123001206_add_unique_index_to_relationships_table.rb +++ b/db/migrate/20241123001206_add_unique_index_to_relationships_table.rb @@ -16,10 +16,10 @@ def change raise "No relationship to keep for target_id #{pm_id}!" if keep.nil? relationships.each do |relationship| if relationship.id == keep.id - puts " Keeping relationship ##{r.id}" + puts " Keeping relationship ##{relationship.id}" else - puts " Deleting relationship ##{r.id}" - relationship.destroy! + puts " Deleting relationship ##{relationship.id}" + relationship.delete end relationship.source.clear_cached_fields relationship.target.clear_cached_fields diff --git a/lib/tasks/migrate/20230216030351_delete_duplicate_relationships.rake b/lib/tasks/migrate/20230216030351_delete_duplicate_relationships.rake index 593a2ff2d..0f733ab03 100644 --- a/lib/tasks/migrate/20230216030351_delete_duplicate_relationships.rake +++ b/lib/tasks/migrate/20230216030351_delete_duplicate_relationships.rake @@ -14,10 +14,10 @@ namespace :check do raise "No relationship to keep for target_id #{pm_id}!" if keep.nil? relationships.each do |relationship| if relationship.id == keep.id - puts " Keeping relationship ##{r.id}" + puts " Keeping relationship ##{relationship.id}" else - puts " Deleting relationship ##{r.id}" - relationship.destroy! + puts " Deleting relationship ##{relationship.id}" + relationship.delete end relationship.source.clear_cached_fields relationship.target.clear_cached_fields