You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/lib/tasks/gitlab_unused.rake

19 lines
637 B

6 years ago
namespace :gitlab do
desc "sync gitlab's commit acts to trustie"
task :unused => :environment do
begin
Project.where("id in (161,236,266)").update_all(:gpid => nil)
repositories = Repository.find_by_sql("select * from repositories where project_id in (select project_id from repositories group by project_id having count(project_id) > 1);")
repositories.each do |rep|
puts "#{rep.id}"
if rep.type == "Repository::Git"
rep.destroy
end
end
# Repository.where("project_id in (161,236,266)").destroy_all
rescue Exception => e
puts e
end
end
end