mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 00:36:14 +02:00
Patch by Takenori TAKAKI (user:takenory). git-svn-id: https://svn.redmine.org/redmine/trunk@23161 e93f8b46-1217-0410-a6f0-8f06a7374b81
12 lines
317 B
Ruby
12 lines
317 B
Ruby
class RemoveOrphanedCustomValueAttachments < ActiveRecord::Migration[7.2]
|
|
def up
|
|
Attachment.where(container_type: 'CustomValue')
|
|
.where('NOT EXISTS (SELECT 1 FROM custom_values WHERE custom_values.id = attachments.container_id)')
|
|
.destroy_all
|
|
end
|
|
|
|
def down
|
|
# no-op
|
|
end
|
|
end
|