mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
removes unneeded migrations
This commit is contained in:
parent
c683cfdbd7
commit
b45717185a
2 changed files with 2 additions and 11 deletions
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue