Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20160324020319_remove_todos_for_deleted_issues.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1fff9759d1e387944baee32d957bb39fbbfb0dfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class RemoveTodosForDeletedIssues < ActiveRecord::Migration
  def up
    execute <<-SQL
      DELETE FROM todos
      WHERE todos.target_type = 'Issue'
        AND NOT EXISTS (
              SELECT *
              FROM issues
              WHERE issues.id = todos.target_id
                AND issues.deleted_at IS NULL
            )
    SQL
  end

  def down
  end
end