diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-24 19:55:42 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-24 19:55:42 +0000 |
commit | 3627a29fa6ddc97b51dcec5517da5531fc56d368 (patch) | |
tree | f24afa92d78528cb60f2cca37a6f2551d8d6afb2 /db | |
parent | 96d32a522652a29aaddb5c6ec727c7780004afff (diff) | |
download | redmine-3627a29fa6ddc97b51dcec5517da5531fc56d368.tar.gz redmine-3627a29fa6ddc97b51dcec5517da5531fc56d368.zip |
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
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20220224194639_delete_orphaned_time_entry_activities.rb | 9 |
1 files changed, 9 insertions, 0 deletions
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 |