Sha256: 00fc2d7528f1fdccea1099c42fc61c0e5eb591553eee198504fc3c88dd1bc6d0
Contents?: true
Size: 1.3 KB
Versions: 9
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Shipit class DestroyStackJob < BackgroundJob queue_as :default # stack # +-- api_clients # +-- commits # | +-- commit_deployments # | | +-- statuses # | +-- statuses # +-- github_hooks # +-- hooks # +-- merge_requests # +-- tasks # +-- chunks def perform(stack) Shipit::ApiClient.where(stack_id: stack.id).delete_all commits_ids = Shipit::Commit.where(stack_id: stack.id).pluck(:id) tasks_ids = Shipit::Task.where(stack_id: stack.id).pluck(:id) commit_deployments_ids = Shipit::CommitDeployment.where(task_id: tasks_ids).pluck(:id) Shipit::CommitDeploymentStatus.where(commit_deployment_id: commit_deployments_ids).delete_all Shipit::CommitDeployment.where(id: commit_deployments_ids).delete_all Shipit::Status.where(commit_id: commits_ids).delete_all Shipit::Commit.where(id: commits_ids).delete_all Shipit::GithubHook.where(stack_id: stack.id).destroy_all Shipit::Hook.where(stack_id: stack.id).delete_all Shipit::MergeRequest.where(stack_id: stack.id).delete_all tasks_ids.each_slice(100) do |ids| Shipit::OutputChunk.where(task_id: ids).delete_all Shipit::Task.where(id: ids).delete_all end stack.destroy! end end end
Version data entries
9 entries across 9 versions & 1 rubygems