From: Marius Balteanu Date: Thu, 24 Feb 2022 19:55:42 +0000 (+0000) Subject: Add migration to delete orphaned time entry activities (#36416). X-Git-Tag: 5.0.0~59 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3627a29fa6ddc97b51dcec5517da5531fc56d368;p=redmine.git Add migration to delete orphaned time entry activities (#36416). Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@21438 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/db/migrate/20220224194639_delete_orphaned_time_entry_activities.rb b/db/migrate/20220224194639_delete_orphaned_time_entry_activities.rb new file mode 100644 index 000000000..51cf0265b --- /dev/null +++ b/db/migrate/20220224194639_delete_orphaned_time_entry_activities.rb @@ -0,0 +1,9 @@ +class DeleteOrphanedTimeEntryActivities < ActiveRecord::Migration[6.1] + def self.up + TimeEntryActivity.left_outer_joins(:project).where(projects:{id: nil}).where.not(project_id: nil).delete_all + end + + def self.down + # no-op + end +end