removes unneeded migrations

This commit is contained in:
zmagod 2018-05-28 13:12:27 +02:00
parent c683cfdbd7
commit b45717185a
2 changed files with 2 additions and 11 deletions

View file

@ -1,9 +0,0 @@
class RemoveRepositoryRowsAndColumnsWithoutRepository < ActiveRecord::Migration[5.1]
def up
if column_exists?(:repositories, :discarded_at)
repository_ids = Repository.select(:id)
RepositoryRow.where.not(repository_id: repository_ids).delete_all
RepositoryColumn.where.not(repository_id: repository_ids).delete_all
end
end
end

View file

@ -3,7 +3,7 @@ namespace :clear_repository_rows_and_columns_without_repository do
'referenced entities with dependent: destroy'
task run: :environment do
repository_ids = Repository.select(:id)
RepositoryRow.where.not(repository_id: repository_ids).delete_all
RepositoryColumn.where.not(repository_id: repository_ids).delete_all
RepositoryRow.where.not(repository_id: repository_ids).destroy_all
RepositoryColumn.where.not(repository_id: repository_ids).destroy_all
end
end