diff --git a/db/migrate/20180518113526_remove_repository_rows_and_columns_without_repository.rb b/db/migrate/20180518113526_remove_repository_rows_and_columns_without_repository.rb deleted file mode 100644 index 69adf5698..000000000 --- a/db/migrate/20180518113526_remove_repository_rows_and_columns_without_repository.rb +++ /dev/null @@ -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 diff --git a/lib/tasks/clear_repository_rows_and_columns_without_repository.rake b/lib/tasks/clear_repository_rows_and_columns_without_repository.rake index c2076a898..d1909b210 100644 --- a/lib/tasks/clear_repository_rows_and_columns_without_repository.rake +++ b/lib/tasks/clear_repository_rows_and_columns_without_repository.rake @@ -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