view .svn/pristine/ce/ce65654e5d3100fb21c21908fc51e7ada1fc2c4a.svn-base @ 1625:808a40a7cac7 live

Have a go at fixing #570 Can't delete downloadable file from version in project with no issue tracker
author Chris Cannam
date Thu, 07 Feb 2019 13:48:00 +0000
parents dffacf8a6908
children
line wrap: on
line source
class DeleteOrphanTimeEntriesCustomValues < ActiveRecord::Migration
  def up
    CustomValue.where("customized_type = ? AND NOT EXISTS (SELECT 1 FROM #{TimeEntry.table_name} t WHERE t.id = customized_id)", "TimeEntry").delete_all
  end

  def down
    # nop
  end
end