98bb435f42
Migrations shouldn't fail RuboCop checks - especially lint checks, such as the nested method check. To avoid changing code in existing migrations, add the magic comment to the top of each of them to skip that file.
17 lines
350 B
Ruby
17 lines
350 B
Ruby
# rubocop:disable all
|
|
class FixTodos < ActiveRecord::Migration
|
|
def up
|
|
execute <<-SQL
|
|
DELETE FROM todos
|
|
WHERE todos.target_type IN ('Commit', 'ProjectSnippet')
|
|
OR NOT EXISTS (
|
|
SELECT *
|
|
FROM projects
|
|
WHERE projects.id = todos.project_id
|
|
)
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
end
|
|
end
|