You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20131218183023_delete_orphan_time_entries_custom_values.rb 273B

123456789
  1. class DeleteOrphanTimeEntriesCustomValues < ActiveRecord::Migration[4.2]
  2. def up
  3. CustomValue.where("customized_type = ? AND NOT EXISTS (SELECT 1 FROM #{TimeEntry.table_name} t WHERE t.id = customized_id)", "TimeEntry").delete_all
  4. end
  5. def down
  6. # nop
  7. end
  8. end