From 56842f90b4dc62f8ad7048e332f8f6f22c51cb71 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Fri, 15 Apr 2022 14:40:10 +0200 Subject: [PATCH 01/11] v0.1.1 --- travis-backup-for-v3.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis-backup-for-v3.gemspec b/travis-backup-for-v3.gemspec index 38ab03b..62b2ab9 100644 --- a/travis-backup-for-v3.gemspec +++ b/travis-backup-for-v3.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'travis-backup-for-v3' - s.version = '0.1.0' + s.version = '0.1.1' s.summary = 'Travis CI backup tool' s.authors = ['Karol Selak'] s.required_ruby_version = Gem::Requirement.new(">= 2.3.0") From 32ce0c38d52d409a75ec5da90b47dff4ba25c1f5 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Tue, 19 Apr 2022 11:46:05 +0200 Subject: [PATCH 02/11] check_values updated, disabled inheritance_column everywhere --- lib/config.rb | 14 +++----------- lib/models/abuse.rb | 2 ++ lib/models/beta_migration_request.rb | 2 ++ lib/models/branch.rb | 2 ++ lib/models/broadcast.rb | 2 ++ lib/models/build.rb | 2 ++ lib/models/build_config.rb | 2 ++ lib/models/cancellation.rb | 2 ++ lib/models/commit.rb | 2 ++ lib/models/cron.rb | 2 ++ lib/models/deleted_build.rb | 2 ++ lib/models/deleted_build_config.rb | 2 ++ lib/models/deleted_commit.rb | 2 ++ lib/models/deleted_job.rb | 2 ++ lib/models/deleted_job_config.rb | 2 ++ lib/models/deleted_pull_request.rb | 2 ++ lib/models/deleted_request.rb | 2 ++ lib/models/deleted_request_config.rb | 2 ++ lib/models/deleted_request_payload.rb | 2 ++ lib/models/deleted_request_raw_config.rb | 2 ++ lib/models/deleted_request_raw_configuration.rb | 2 ++ lib/models/deleted_request_yaml_config.rb | 2 ++ lib/models/deleted_ssl_key.rb | 2 ++ lib/models/deleted_stage.rb | 2 ++ lib/models/deleted_tag.rb | 2 ++ lib/models/email.rb | 2 ++ lib/models/email_unsubscribe.rb | 2 ++ lib/models/installation.rb | 2 ++ lib/models/invoice.rb | 2 ++ lib/models/job_config.rb | 2 ++ lib/models/job_version.rb | 2 ++ lib/models/membership.rb | 2 ++ lib/models/message.rb | 2 ++ lib/models/organization.rb | 2 ++ lib/models/owner_group.rb | 2 ++ lib/models/permission.rb | 2 ++ lib/models/pull_request.rb | 2 ++ lib/models/queueable_job.rb | 2 ++ lib/models/repo_count.rb | 2 ++ lib/models/repository.rb | 2 ++ lib/models/request.rb | 2 ++ lib/models/request_config.rb | 2 ++ lib/models/request_payload.rb | 2 ++ lib/models/request_raw_config.rb | 2 ++ lib/models/request_raw_configuration.rb | 2 ++ lib/models/request_yaml_config.rb | 2 ++ lib/models/ssl_key.rb | 2 ++ lib/models/stage.rb | 2 ++ lib/models/star.rb | 2 ++ lib/models/subscription.rb | 2 ++ lib/models/tag.rb | 2 ++ lib/models/token.rb | 2 ++ lib/models/trial.rb | 2 ++ lib/models/trial_allowance.rb | 2 ++ lib/models/user.rb | 2 ++ lib/models/user_beta_feature.rb | 2 ++ lib/models/user_utm_param.rb | 2 ++ 57 files changed, 115 insertions(+), 11 deletions(-) diff --git a/lib/config.rb b/lib/config.rb index d3b3d9c..fbdb7de 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -129,7 +129,7 @@ def set_values(args) end def check_values - if !@move_logs && !@remove_orphans && !@threshold && !@user_id && !@org_id && !@repo_id && !@load_from_files + if !@threshold && !@user_id && !@org_id && !@repo_id && !@load_from_files message = abort_message("Please provide the threshold argument. Data younger than it will be omitted. " + "Threshold defines number of months from now. Alternatively you can define user_id, org_id or repo_id " + "to remove whole user, organization or repository with all dependencies.") @@ -140,20 +140,12 @@ def check_values message = abort_message("Please provide proper database URL.") abort message end - - if (@move_logs && !@destination_db_url) - abort "\nFor moving logs you need to specify your destination database. Example usage:\n" + - "\n $ bin/travis_backup 'postgres://source_url' --move_logs --destination_db_url 'postgres://destination_url'\n" + - "\nor using in code:\n" + - "\n Backup.new(database_url: 'postgres://source_url', destination_db_url: 'postgres://destination_url', move_logs: true)\n" + - "\nYou can also set it using environment variables or configuration files.\n" - end end def abort_message(intro) "\n#{intro}\n\nExample usage:\n"+ - "\n $ bin/travis_backup 'postgres://my_database_url' --threshold 6" + - "\n $ bin/travis_backup 'postgres://my_database_url' --user_id 1\n" + + "\n $ travis_backup_for_v3 'postgres://my_database_url' --threshold 6" + + "\n $ travis_backup_for_v3 'postgres://my_database_url' --user_id 1\n" + "\nor using in code:\n" + "\n Backup.new(database_url: 'postgres://my_database_url', threshold: 6)" + "\n Backup.new(database_url: 'postgres://my_database_url', user_id: 1)\n" + diff --git a/lib/models/abuse.rb b/lib/models/abuse.rb index a0bd2cb..52c3265 100644 --- a/lib/models/abuse.rb +++ b/lib/models/abuse.rb @@ -3,6 +3,8 @@ require 'model' class Abuse < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true belongs_to :request end diff --git a/lib/models/beta_migration_request.rb b/lib/models/beta_migration_request.rb index 8a019cf..44a24a5 100644 --- a/lib/models/beta_migration_request.rb +++ b/lib/models/beta_migration_request.rb @@ -3,6 +3,8 @@ require 'model' class BetaMigrationRequest < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true has_many :organizations end diff --git a/lib/models/branch.rb b/lib/models/branch.rb index 36cef60..de7099e 100644 --- a/lib/models/branch.rb +++ b/lib/models/branch.rb @@ -3,6 +3,8 @@ require 'model' class Branch < Model + self.inheritance_column = :_type_disabled + belongs_to :last_build, foreign_key: :last_build_id, class_name: 'Build' belongs_to :repository has_many :builds diff --git a/lib/models/broadcast.rb b/lib/models/broadcast.rb index fbdd68e..13143bb 100644 --- a/lib/models/broadcast.rb +++ b/lib/models/broadcast.rb @@ -3,5 +3,7 @@ require 'model' class Broadcast < Model + self.inheritance_column = :_type_disabled + belongs_to :recipient, polymorphic: true end diff --git a/lib/models/build.rb b/lib/models/build.rb index afb8c6b..1f1649a 100644 --- a/lib/models/build.rb +++ b/lib/models/build.rb @@ -3,6 +3,8 @@ require 'model' class Build < Model + self.inheritance_column = :_type_disabled + belongs_to :repository belongs_to :owner, polymorphic: true belongs_to :sender, polymorphic: true diff --git a/lib/models/build_config.rb b/lib/models/build_config.rb index 0f0f1c7..4e5a579 100644 --- a/lib/models/build_config.rb +++ b/lib/models/build_config.rb @@ -3,6 +3,8 @@ require 'model' class BuildConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :builds, foreign_key: :config_id, class_name: 'Build' has_many :deleted_builds, foreign_key: :config_id, class_name: 'DeletedBuild' diff --git a/lib/models/cancellation.rb b/lib/models/cancellation.rb index 2d949cd..656e0f8 100644 --- a/lib/models/cancellation.rb +++ b/lib/models/cancellation.rb @@ -3,6 +3,8 @@ require 'model' class Cancellation < Model + self.inheritance_column = :_type_disabled + belongs_to :subscription belongs_to :user end diff --git a/lib/models/commit.rb b/lib/models/commit.rb index 9fcc266..cb2b512 100644 --- a/lib/models/commit.rb +++ b/lib/models/commit.rb @@ -3,6 +3,8 @@ require 'model' class Commit < Model + self.inheritance_column = :_type_disabled + belongs_to :related_branch, foreign_key: :branch_id, class_name: 'Branch' belongs_to :repository belongs_to :tag diff --git a/lib/models/cron.rb b/lib/models/cron.rb index 1240176..8c1525b 100644 --- a/lib/models/cron.rb +++ b/lib/models/cron.rb @@ -3,5 +3,7 @@ require 'model' class Cron < Model + self.inheritance_column = :_type_disabled + belongs_to :branch end diff --git a/lib/models/deleted_build.rb b/lib/models/deleted_build.rb index 77aa54d..94c69f3 100644 --- a/lib/models/deleted_build.rb +++ b/lib/models/deleted_build.rb @@ -3,6 +3,8 @@ require 'model' class DeletedBuild < Model + self.inheritance_column = :_type_disabled + belongs_to :repository belongs_to :owner, polymorphic: true belongs_to :sender, polymorphic: true diff --git a/lib/models/deleted_build_config.rb b/lib/models/deleted_build_config.rb index e4a4635..e5a03c5 100644 --- a/lib/models/deleted_build_config.rb +++ b/lib/models/deleted_build_config.rb @@ -3,6 +3,8 @@ require 'model' class DeletedBuildConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_commit.rb b/lib/models/deleted_commit.rb index 0da240f..6896357 100644 --- a/lib/models/deleted_commit.rb +++ b/lib/models/deleted_commit.rb @@ -3,6 +3,8 @@ require 'model' class DeletedCommit < Model + self.inheritance_column = :_type_disabled + belongs_to :related_branch, foreign_key: :branch_id, class_name: 'Branch' belongs_to :repository belongs_to :tag diff --git a/lib/models/deleted_job.rb b/lib/models/deleted_job.rb index d63135d..6bd2110 100644 --- a/lib/models/deleted_job.rb +++ b/lib/models/deleted_job.rb @@ -3,6 +3,8 @@ require 'model' class DeletedJob < Model + self.inheritance_column = :_type_disabled + belongs_to :source, polymorphic: true belongs_to :owner, polymorphic: true belongs_to :repository diff --git a/lib/models/deleted_job_config.rb b/lib/models/deleted_job_config.rb index c4c9bc0..4417a44 100644 --- a/lib/models/deleted_job_config.rb +++ b/lib/models/deleted_job_config.rb @@ -3,6 +3,8 @@ require 'model' class DeletedJobConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_pull_request.rb b/lib/models/deleted_pull_request.rb index b8b412e..bae25f2 100644 --- a/lib/models/deleted_pull_request.rb +++ b/lib/models/deleted_pull_request.rb @@ -3,6 +3,8 @@ require 'model' class DeletedPullRequest < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_request.rb b/lib/models/deleted_request.rb index 8c2dace..fd53e80 100644 --- a/lib/models/deleted_request.rb +++ b/lib/models/deleted_request.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequest < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true belongs_to :sender, polymorphic: true belongs_to :repository diff --git a/lib/models/deleted_request_config.rb b/lib/models/deleted_request_config.rb index 3ff3700..2a526d7 100644 --- a/lib/models/deleted_request_config.rb +++ b/lib/models/deleted_request_config.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequestConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_request_payload.rb b/lib/models/deleted_request_payload.rb index 909356f..642ae9e 100644 --- a/lib/models/deleted_request_payload.rb +++ b/lib/models/deleted_request_payload.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequestPayload < Model + self.inheritance_column = :_type_disabled + belongs_to :request self.primary_key = 'id' end diff --git a/lib/models/deleted_request_raw_config.rb b/lib/models/deleted_request_raw_config.rb index b936ede..8ce48a4 100644 --- a/lib/models/deleted_request_raw_config.rb +++ b/lib/models/deleted_request_raw_config.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequestRawConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_request_raw_configuration.rb b/lib/models/deleted_request_raw_configuration.rb index 58b9379..cb7efc9 100644 --- a/lib/models/deleted_request_raw_configuration.rb +++ b/lib/models/deleted_request_raw_configuration.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequestRawConfiguration < Model + self.inheritance_column = :_type_disabled + belongs_to :request_raw_configs belongs_to :requests self.primary_key = 'id' diff --git a/lib/models/deleted_request_yaml_config.rb b/lib/models/deleted_request_yaml_config.rb index 3f01af2..163da23 100644 --- a/lib/models/deleted_request_yaml_config.rb +++ b/lib/models/deleted_request_yaml_config.rb @@ -3,6 +3,8 @@ require 'model' class DeletedRequestYamlConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_ssl_key.rb b/lib/models/deleted_ssl_key.rb index bd43488..2ef8819 100644 --- a/lib/models/deleted_ssl_key.rb +++ b/lib/models/deleted_ssl_key.rb @@ -3,6 +3,8 @@ require 'model' class DeletedSslKey < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'id' end diff --git a/lib/models/deleted_stage.rb b/lib/models/deleted_stage.rb index 182c0c6..fa22a63 100644 --- a/lib/models/deleted_stage.rb +++ b/lib/models/deleted_stage.rb @@ -3,6 +3,8 @@ require 'model' class DeletedStage < Model + self.inheritance_column = :_type_disabled + belongs_to :build self.primary_key = 'id' end diff --git a/lib/models/deleted_tag.rb b/lib/models/deleted_tag.rb index 72081a6..f055edf 100644 --- a/lib/models/deleted_tag.rb +++ b/lib/models/deleted_tag.rb @@ -3,6 +3,8 @@ require 'model' class DeletedTag < Model + self.inheritance_column = :_type_disabled + belongs_to :last_build, foreign_key: :last_build_id, class_name: 'Build' belongs_to :repository self.primary_key = 'id' diff --git a/lib/models/email.rb b/lib/models/email.rb index e6bda5d..fdcaedb 100644 --- a/lib/models/email.rb +++ b/lib/models/email.rb @@ -3,5 +3,7 @@ require 'model' class Email < Model + self.inheritance_column = :_type_disabled + belongs_to :user end diff --git a/lib/models/email_unsubscribe.rb b/lib/models/email_unsubscribe.rb index c3f311e..49787b0 100644 --- a/lib/models/email_unsubscribe.rb +++ b/lib/models/email_unsubscribe.rb @@ -3,6 +3,8 @@ require 'model' class EmailUnsubscribe < Model + self.inheritance_column = :_type_disabled + belongs_to :repository belongs_to :user end diff --git a/lib/models/installation.rb b/lib/models/installation.rb index 86a8804..5f56800 100644 --- a/lib/models/installation.rb +++ b/lib/models/installation.rb @@ -3,5 +3,7 @@ require 'model' class Installation < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true end diff --git a/lib/models/invoice.rb b/lib/models/invoice.rb index 3bf4f9f..ec3a3f8 100644 --- a/lib/models/invoice.rb +++ b/lib/models/invoice.rb @@ -3,5 +3,7 @@ require 'model' class Invoice < Model + self.inheritance_column = :_type_disabled + belongs_to :subscription end diff --git a/lib/models/job_config.rb b/lib/models/job_config.rb index 6f190ac..1f6621d 100644 --- a/lib/models/job_config.rb +++ b/lib/models/job_config.rb @@ -3,6 +3,8 @@ require 'model' class JobConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :jobs, foreign_key: :config_id, class_name: 'Job' has_many :deleted_jobs, foreign_key: :config_id, class_name: 'DeletedJob' diff --git a/lib/models/job_version.rb b/lib/models/job_version.rb index b92569b..f205a7c 100644 --- a/lib/models/job_version.rb +++ b/lib/models/job_version.rb @@ -3,5 +3,7 @@ require 'model' class JobVersion < Model + self.inheritance_column = :_type_disabled + belongs_to :job end diff --git a/lib/models/membership.rb b/lib/models/membership.rb index 5054aee..91acaf4 100644 --- a/lib/models/membership.rb +++ b/lib/models/membership.rb @@ -3,6 +3,8 @@ require 'model' class Membership < Model + self.inheritance_column = :_type_disabled + belongs_to :organization belongs_to :user end diff --git a/lib/models/message.rb b/lib/models/message.rb index 3f503c8..4ae8540 100644 --- a/lib/models/message.rb +++ b/lib/models/message.rb @@ -3,5 +3,7 @@ require 'model' class Message < Model + self.inheritance_column = :_type_disabled + belongs_to :subject, polymorphic: true end diff --git a/lib/models/organization.rb b/lib/models/organization.rb index 1cb8e9a..4d14bcb 100644 --- a/lib/models/organization.rb +++ b/lib/models/organization.rb @@ -3,6 +3,8 @@ require 'model' class Organization < Model + self.inheritance_column = :_type_disabled + belongs_to :beta_migration_request has_many :builds_for_that_this_organization_is_owner, as: :owner, class_name: 'Build' has_many :builds_for_that_this_organization_is_sender, as: :sender, class_name: 'Build' diff --git a/lib/models/owner_group.rb b/lib/models/owner_group.rb index c6d5677..12d0f75 100644 --- a/lib/models/owner_group.rb +++ b/lib/models/owner_group.rb @@ -3,5 +3,7 @@ require 'model' class OwnerGroup < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true end diff --git a/lib/models/permission.rb b/lib/models/permission.rb index 3a4f9dc..1056586 100644 --- a/lib/models/permission.rb +++ b/lib/models/permission.rb @@ -3,6 +3,8 @@ require 'model' class Permission < Model + self.inheritance_column = :_type_disabled + belongs_to :repository belongs_to :user end diff --git a/lib/models/pull_request.rb b/lib/models/pull_request.rb index a314238..8f83b13 100644 --- a/lib/models/pull_request.rb +++ b/lib/models/pull_request.rb @@ -3,6 +3,8 @@ require 'model' class PullRequest < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :requests has_many :builds diff --git a/lib/models/queueable_job.rb b/lib/models/queueable_job.rb index c8fdeb9..90eeed0 100644 --- a/lib/models/queueable_job.rb +++ b/lib/models/queueable_job.rb @@ -3,5 +3,7 @@ require 'model' class QueueableJob < Model + self.inheritance_column = :_type_disabled + belongs_to :job end diff --git a/lib/models/repo_count.rb b/lib/models/repo_count.rb index d5935f8..c0f7652 100644 --- a/lib/models/repo_count.rb +++ b/lib/models/repo_count.rb @@ -3,6 +3,8 @@ require 'model' class RepoCount < Model + self.inheritance_column = :_type_disabled + belongs_to :repository self.primary_key = 'repository_id' end diff --git a/lib/models/repository.rb b/lib/models/repository.rb index e7c5d77..b591aa5 100644 --- a/lib/models/repository.rb +++ b/lib/models/repository.rb @@ -3,6 +3,8 @@ require 'model' class Repository < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true belongs_to :current_build, foreign_key: :current_build_id, class_name: 'Build' belongs_to :last_build, foreign_key: :last_build_id, class_name: 'Build' diff --git a/lib/models/request.rb b/lib/models/request.rb index dfd0b1e..02287dc 100644 --- a/lib/models/request.rb +++ b/lib/models/request.rb @@ -3,6 +3,8 @@ require 'model' class Request < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true belongs_to :sender, polymorphic: true belongs_to :repository diff --git a/lib/models/request_config.rb b/lib/models/request_config.rb index 15794d8..822518c 100644 --- a/lib/models/request_config.rb +++ b/lib/models/request_config.rb @@ -3,6 +3,8 @@ require 'model' class RequestConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :requests, foreign_key: :config_id, class_name: 'Request' has_many :deleted_requests, foreign_key: :config_id, class_name: 'DeletedRequest' diff --git a/lib/models/request_payload.rb b/lib/models/request_payload.rb index 7cfed93..19b2270 100644 --- a/lib/models/request_payload.rb +++ b/lib/models/request_payload.rb @@ -3,5 +3,7 @@ require 'model' class RequestPayload < Model + self.inheritance_column = :_type_disabled + belongs_to :request end diff --git a/lib/models/request_raw_config.rb b/lib/models/request_raw_config.rb index 87aeeda..8e060c5 100644 --- a/lib/models/request_raw_config.rb +++ b/lib/models/request_raw_config.rb @@ -3,6 +3,8 @@ require 'model' class RequestRawConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :request_raw_configurations has_many :deleted_request_raw_configurations diff --git a/lib/models/request_raw_configuration.rb b/lib/models/request_raw_configuration.rb index 6b8c7ca..5c28b58 100644 --- a/lib/models/request_raw_configuration.rb +++ b/lib/models/request_raw_configuration.rb @@ -3,6 +3,8 @@ require 'model' class RequestRawConfiguration < Model + self.inheritance_column = :_type_disabled + belongs_to :request_raw_configs belongs_to :requests end diff --git a/lib/models/request_yaml_config.rb b/lib/models/request_yaml_config.rb index 74ec998..b4f10c5 100644 --- a/lib/models/request_yaml_config.rb +++ b/lib/models/request_yaml_config.rb @@ -3,6 +3,8 @@ require 'model' class RequestYamlConfig < Model + self.inheritance_column = :_type_disabled + belongs_to :repository has_many :requests, foreign_key: :yaml_config_id, class_name: 'Request' has_many :deleted_requests, foreign_key: :yaml_config_id, class_name: 'DeletedRequest' diff --git a/lib/models/ssl_key.rb b/lib/models/ssl_key.rb index 7c8c6e8..2236560 100644 --- a/lib/models/ssl_key.rb +++ b/lib/models/ssl_key.rb @@ -3,5 +3,7 @@ require 'model' class SslKey < Model + self.inheritance_column = :_type_disabled + belongs_to :repository end diff --git a/lib/models/stage.rb b/lib/models/stage.rb index 4b8c329..cffe017 100644 --- a/lib/models/stage.rb +++ b/lib/models/stage.rb @@ -3,6 +3,8 @@ require 'model' class Stage < Model + self.inheritance_column = :_type_disabled + belongs_to :build has_many :jobs has_many :deleted_jobs diff --git a/lib/models/star.rb b/lib/models/star.rb index fd252a8..6167d51 100644 --- a/lib/models/star.rb +++ b/lib/models/star.rb @@ -3,6 +3,8 @@ require 'model' class Star < Model + self.inheritance_column = :_type_disabled + belongs_to :repository belongs_to :user end diff --git a/lib/models/subscription.rb b/lib/models/subscription.rb index 39c7aa2..153b368 100644 --- a/lib/models/subscription.rb +++ b/lib/models/subscription.rb @@ -3,6 +3,8 @@ require 'model' class Subscription < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true has_many :invoices has_many :cancellations diff --git a/lib/models/tag.rb b/lib/models/tag.rb index e4274bc..8d08de4 100644 --- a/lib/models/tag.rb +++ b/lib/models/tag.rb @@ -3,6 +3,8 @@ require 'model' class Tag < Model + self.inheritance_column = :_type_disabled + belongs_to :last_build, foreign_key: :last_build_id, class_name: 'Build' belongs_to :repository has_many :builds diff --git a/lib/models/token.rb b/lib/models/token.rb index 0733332..9aa0405 100644 --- a/lib/models/token.rb +++ b/lib/models/token.rb @@ -3,5 +3,7 @@ require 'model' class Token < Model + self.inheritance_column = :_type_disabled + belongs_to :user end diff --git a/lib/models/trial.rb b/lib/models/trial.rb index 9984894..d0dcf7d 100644 --- a/lib/models/trial.rb +++ b/lib/models/trial.rb @@ -3,6 +3,8 @@ require 'model' class Trial < Model + self.inheritance_column = :_type_disabled + belongs_to :owner, polymorphic: true has_many :trial_allowances end diff --git a/lib/models/trial_allowance.rb b/lib/models/trial_allowance.rb index 06d4308..4610216 100644 --- a/lib/models/trial_allowance.rb +++ b/lib/models/trial_allowance.rb @@ -3,6 +3,8 @@ require 'model' class TrialAllowance < Model + self.inheritance_column = :_type_disabled + belongs_to :creator, polymorphic: true belongs_to :trial end diff --git a/lib/models/user.rb b/lib/models/user.rb index 6ecd71a..0fb5a18 100644 --- a/lib/models/user.rb +++ b/lib/models/user.rb @@ -3,6 +3,8 @@ require 'model' class User < Model + self.inheritance_column = :_type_disabled + has_many :builds_for_that_this_user_is_owner, as: :owner, class_name: 'Build' has_many :builds_for_that_this_user_is_sender, as: :sender, class_name: 'Build' has_many :repositories, as: :owner diff --git a/lib/models/user_beta_feature.rb b/lib/models/user_beta_feature.rb index 0a09be3..9bfb53b 100644 --- a/lib/models/user_beta_feature.rb +++ b/lib/models/user_beta_feature.rb @@ -3,5 +3,7 @@ require 'model' class UserBetaFeature < Model + self.inheritance_column = :_type_disabled + belongs_to :user end diff --git a/lib/models/user_utm_param.rb b/lib/models/user_utm_param.rb index 41305c0..3bec875 100644 --- a/lib/models/user_utm_param.rb +++ b/lib/models/user_utm_param.rb @@ -3,5 +3,7 @@ require 'model' class UserUtmParam < Model + self.inheritance_column = :_type_disabled + belongs_to :user end From f316cea1b1230851af48ea4e3996e6e5f0fa8348 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Tue, 26 Apr 2022 20:00:16 +0200 Subject: [PATCH 03/11] backup_spec tests uncommented --- Gemfile.lock | 2 +- spec/backup_spec.rb | 84 ++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 54083f4..592f5fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - travis-backup-for-v3 (0.1.0) + travis-backup-for-v3 (0.1.1) activerecord bootsnap pg diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index 65b0711..8da2565 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb @@ -84,50 +84,50 @@ end end - # context 'when threshold for heavy data is not given' do - # context 'when user_id is given' do - # let!(:backup) { Backup.new( - # files_location: files_location, - # limit: 5, - # threshold: false, - # user_id: user1.id - # ) } - # it 'removes the user with all dependencies' do - # expect_any_instance_of(Backup::RemoveSpecified) - # .to receive(:remove_user_with_dependencies).once.with(user1.id) - # backup.run(user_id: user1.id) - # end - # end + context 'when threshold for heavy data is not given' do + context 'when user_id is given' do + let!(:backup) { Backup.new( + files_location: files_location, + limit: 5, + threshold: false, + user_id: user1.id + ) } + it 'removes the user with all dependencies' do + expect_any_instance_of(Backup::RemoveSpecified) + .to receive(:remove_user_with_dependencies).once.with(user1.id) + backup.run(user_id: user1.id) + end + end - # context 'when org_id is given' do - # let!(:backup) { Backup.new( - # files_location: files_location, - # limit: 5, - # threshold: false, - # org_id: user1.id - # ) } - # it 'removes the organisation with all dependencies' do - # expect_any_instance_of(Backup::RemoveSpecified) - # .to receive(:remove_org_with_dependencies).once.with(organization1.id) - # backup.run(org_id: organization1.id) - # end - # end + context 'when org_id is given' do + let!(:backup) { Backup.new( + files_location: files_location, + limit: 5, + threshold: false, + org_id: user1.id + ) } + it 'removes the organisation with all dependencies' do + expect_any_instance_of(Backup::RemoveSpecified) + .to receive(:remove_org_with_dependencies).once.with(organization1.id) + backup.run(org_id: organization1.id) + end + end - # context 'when repo_id is given' do - # let!(:backup) { Backup.new( - # files_location: files_location, - # limit: 5, - # threshold: false, - # repo_id: user1.id - # ) } - # it 'removes the repo with all dependencies' do - # repo = Repository.first - # expect_any_instance_of(Backup::RemoveSpecified) - # .to receive(:remove_repo_with_dependencies).once.with(repo.id) - # backup.run(repo_id: repo.id) - # end - # end - # end + context 'when repo_id is given' do + let!(:backup) { Backup.new( + files_location: files_location, + limit: 5, + threshold: false, + repo_id: user1.id + ) } + it 'removes the repo with all dependencies' do + repo = Repository.first + expect_any_instance_of(Backup::RemoveSpecified) + .to receive(:remove_repo_with_dependencies).once.with(repo.id) + backup.run(repo_id: repo.id) + end + end + end context 'when dry run mode is on' do let!(:backup) { Backup.new(files_location: files_location, limit: 10, dry_run: true, threshold: 0) } From 29f334ec4f0cf92f51f588c0040825fbc3da8a78 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Tue, 26 Apr 2022 22:40:54 +0200 Subject: [PATCH 04/11] create_for_repo_without_timestamps --- spec/support/factories/repository.rb | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index 762defa..cc73365 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -12,6 +12,13 @@ def create_for_repo(repository, what, how_many = 1) ) end +def create_for_repo_without_timestamps(repository, what, how_many = 1) + create_list( + what, how_many, + repository_id: repository.id + ) +end + FactoryBot.define do factory :repository do factory :repository_with_builds_jobs_and_logs do @@ -83,7 +90,7 @@ def create_for_repo(repository, what, how_many = 1) create_for_repo(repository, :branch_with_all_dependencies_and_sibling) create_for_repo(repository, :commit_with_all_dependencies_and_sibling) create_for_repo(repository, :ssl_key, 2) - create_list(:permission, 2, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :permission, 2) create_for_repo(repository, :star, 2) create_for_repo(repository, :pull_request_with_all_dependencies_and_sibling) create_for_repo(repository, :tag_with_all_dependencies_and_sibling) @@ -92,8 +99,8 @@ def create_for_repo(repository, what, how_many = 1) create_for_repo(repository, :email_unsubscribe, 2) create_for_repo(repository, :request_config_with_all_dependencies_and_sibling) create_for_repo(repository, :job_config_with_all_dependencies_and_sibling) - create(:request_raw_config_with_all_dependencies_and_sibling, repository_id: repository.id) - create_list(:repo_count, 2, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :request_raw_config_with_all_dependencies_and_sibling) + create_for_repo_without_timestamps(repository, :repo_count, 2) create_for_repo(repository, :request_yaml_config_with_all_dependencies_and_sibling) create_for_repo(repository, :deleted_build, 2) @@ -103,11 +110,11 @@ def create_for_repo(repository, what, how_many = 1) create_for_repo(repository, :deleted_commit, 2) create_for_repo(repository, :deleted_pull_request, 2) create_for_repo(repository, :deleted_tag, 2) - create_list(:deleted_build_config, 2, repository_id: repository.id) - create_list(:deleted_job_config, 2, repository_id: repository.id) - create_list(:deleted_request_config, 2, repository_id: repository.id) - create_list(:deleted_request_raw_config, 2, repository_id: repository.id) - create_list(:deleted_request_yaml_config, 2, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :deleted_build_config, 2) + create_for_repo_without_timestamps(repository, :deleted_job_config, 2) + create_for_repo_without_timestamps(repository, :deleted_request_config, 2) + create_for_repo_without_timestamps(repository, :deleted_request_raw_config, 2) + create_for_repo_without_timestamps(repository, :deleted_request_yaml_config, 2) end factory :repository_with_all_dependencies_and_sibling do @@ -122,10 +129,10 @@ def create_for_repo(repository, what, how_many = 1) after(:create) do |repository| create_for_repo(repository, :build_for_removing_heavy_data) - create(:build_for_removing_heavy_data, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :build_for_removing_heavy_data) last_build = create_for_repo(repository, :build_for_removing_heavy_data).last create_for_repo(repository, :request) - create(:request, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :request) repository.update(last_build_id: last_build.id) end @@ -140,7 +147,7 @@ def create_for_repo(repository, what, how_many = 1) create_for_repo(repository, :branch) create_for_repo(repository, :commit) create_for_repo(repository, :ssl_key) - create(:permission, repository_id: repository.id) + create_for_repo_without_timestamps(repository, :permission) create_for_repo(repository, :star) create_for_repo(repository, :pull_request) create_for_repo(repository, :tag) From 682658385dce012fe61160e8487bd0531b8a8da7 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Wed, 27 Apr 2022 01:50:47 +0200 Subject: [PATCH 05/11] removing configs wip --- .../remove_repo_requests.rb | 216 +++++++++--------- spec/support/factories/repository.rb | 30 +++ 2 files changed, 141 insertions(+), 105 deletions(-) diff --git a/spec/support/expected_dependency_trees/remove_repo_requests.rb b/spec/support/expected_dependency_trees/remove_repo_requests.rb index 4a6503c..4eee418 100644 --- a/spec/support/expected_dependency_trees/remove_repo_requests.rb +++ b/spec/support/expected_dependency_trees/remove_repo_requests.rb @@ -623,6 +623,26 @@ def self.remove_repo_requests ] }, "id 51, present", + { + "_": "id 163, present", + "job": [ + "id 164, present" + ], + "repository": [ + "id 67, present", + "id 66, present" + ], + "tag": [ + "id 39, present" + ], + "branch": [ + "id 39, present" + ], + "stage": [ + "id 35, present" + ] + }, + "id 165, present", { "_": "id 178, present", "job": [ @@ -799,6 +819,78 @@ def self.remove_repo_requests ] }, "id 12, removed", + { + "_": "id 35, removed", + "abuse": [ + "id 31, removed", + "id 32, removed" + ], + "message": [ + "id 31, removed", + "id 32, removed" + ], + "job": [ + { + "_": "id 169, removed", + "queueable_job": [ + "id 57, removed", + "id 58, removed" + ], + "job_version": [ + "id 57, removed", + "id 58, removed" + ] + }, + "id 170, removed" + ], + "build": [ + { + "_": "id 166, removed", + "job": [ + "id 167, removed" + ], + "repository": [ + "id 69, present", + "id 68, present" + ], + "tag": [ + "id 40, present" + ], + "branch": [ + "id 40, present" + ], + "stage": [ + "id 36, removed" + ] + }, + "id 168, removed" + ], + "request_payload": [ + "id 31, removed", + "id 32, removed" + ], + "request_raw_configuration": [ + "id 31, removed", + "id 32, removed" + ], + "deleted_job": [ + "id 53, removed", + "id 54, removed" + ], + "deleted_build": [ + "id 61, removed", + "id 62, removed" + ], + "deleted_request_payload": [ + "id 31, removed", + "id 32, removed" + ], + "deleted_request_raw_configuration": [ + "id 31, removed", + "id 32, removed" + ] + }, + "id 36, removed", "id 39, removed", "id 40, present" ], @@ -814,7 +906,19 @@ def self.remove_repo_requests "id 20, present" ] }, - "id 58, present" + "id 58, present", + { + "_": "id 171, present", + "queueable_job": [ + "id 59, present", + "id 60, present" + ], + "job_version": [ + "id 59, present", + "id 60, present" + ] + }, + "id 172, present" ], "branch": [ { @@ -2175,26 +2279,8 @@ def self.remove_repo_requests { "_": "id 1, present", "build": [ - { - "_": "id 163, present", - "job": [ - "id 164, present" - ], - "repository": [ - "id 67, present", - "id 66, present" - ], - "tag": [ - "id 39, present" - ], - "branch": [ - "id 39, present" - ], - "stage": [ - "id 35, present" - ] - }, - "id 165, present" + "id 163, present, duplicate", + "id 165, present, duplicate" ], "deleted_build": [ "id 59, present", @@ -2211,78 +2297,8 @@ def self.remove_repo_requests { "_": "id 1, present", "request": [ - { - "_": "id 35, present", - "abuse": [ - "id 31, present", - "id 32, present" - ], - "message": [ - "id 31, present", - "id 32, present" - ], - "job": [ - { - "_": "id 169, present", - "queueable_job": [ - "id 57, present", - "id 58, present" - ], - "job_version": [ - "id 57, present", - "id 58, present" - ] - }, - "id 170, present" - ], - "build": [ - { - "_": "id 166, present", - "job": [ - "id 167, present" - ], - "repository": [ - "id 69, present", - "id 68, present" - ], - "tag": [ - "id 40, present" - ], - "branch": [ - "id 40, present" - ], - "stage": [ - "id 36, present" - ] - }, - "id 168, present" - ], - "request_payload": [ - "id 31, present", - "id 32, present" - ], - "request_raw_configuration": [ - "id 31, present", - "id 32, present" - ], - "deleted_job": [ - "id 53, present", - "id 54, present" - ], - "deleted_build": [ - "id 61, present", - "id 62, present" - ], - "deleted_request_payload": [ - "id 31, present", - "id 32, present" - ], - "deleted_request_raw_configuration": [ - "id 31, present", - "id 32, present" - ] - }, - "id 36, present" + "id 35, removed, duplicate", + "id 36, removed, duplicate" ], "deleted_request": [ "id 29, present", @@ -2295,18 +2311,8 @@ def self.remove_repo_requests { "_": "id 1, present", "job": [ - { - "_": "id 171, present", - "queueable_job": [ - "id 59, present", - "id 60, present" - ], - "job_version": [ - "id 59, present", - "id 60, present" - ] - }, - "id 172, present" + "id 171, present, duplicate", + "id 172, present, duplicate" ], "deleted_job": [ "id 55, present", diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index cc73365..906c6c7 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -135,6 +135,36 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) create_for_repo_without_timestamps(repository, :request) repository.update(last_build_id: last_build.id) + + repository.request_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) + end + end + + repository.request_raw_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) + end + end + + repository.request_yaml_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) + end + end + + repository.build_configs.each do |config| + config.builds.each do |build| + build.update(repository_id: repository.id) + end + end + + repository.job_configs.each do |config| + config.jobs.each do |job| + job.update(repository_id: repository.id) + end + end end end end From c02ff1ed8d652dbfc7720fc682140ee4fe92e730 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Wed, 27 Apr 2022 09:04:58 +0200 Subject: [PATCH 06/11] removing configs wip --- .../remove_specified/remove_heavy_data.rb | 104 +++++++-- lib/backup/save_id_hash_to_file.rb | 1 - spec/backup/remove_specified_spec.rb | 197 +++++++++--------- .../remove_repo_requests.rb | 160 +++++++------- .../remove_repo_requests/abuse_9-10.json | 25 --- .../remove_repo_requests/build_52-54.json | 95 --------- .../deleted_build_17-18.json | 95 --------- .../deleted_job_16-17.json | 73 ------- .../deleted_request_payload_9-10.json | 21 -- ...eleted_request_raw_configuration_9-10.json | 21 -- .../remove_repo_requests/job_53-56.json | 107 ---------- .../job_version_17-18.json | 29 --- .../remove_repo_requests/message_9-10.json | 33 --- .../queueable_job_17-18.json | 13 -- .../remove_repo_requests/request_11-39.json | 101 --------- .../request_payload_9-10.json | 21 -- .../request_raw_configuration_9-10.json | 21 -- .../remove_repo_requests/stage_12-12.json | 16 -- spec/support/factories/repository.rb | 12 +- 19 files changed, 274 insertions(+), 871 deletions(-) delete mode 100644 spec/support/expected_files/remove_repo_requests/abuse_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/build_52-54.json delete mode 100644 spec/support/expected_files/remove_repo_requests/deleted_build_17-18.json delete mode 100644 spec/support/expected_files/remove_repo_requests/deleted_job_16-17.json delete mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/job_53-56.json delete mode 100644 spec/support/expected_files/remove_repo_requests/job_version_17-18.json delete mode 100644 spec/support/expected_files/remove_repo_requests/message_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/queueable_job_17-18.json delete mode 100644 spec/support/expected_files/remove_repo_requests/request_11-39.json delete mode 100644 spec/support/expected_files/remove_repo_requests/request_payload_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-10.json delete mode 100644 spec/support/expected_files/remove_repo_requests/stage_12-12.json diff --git a/lib/backup/remove_specified/remove_heavy_data.rb b/lib/backup/remove_specified/remove_heavy_data.rb index 632a9c2..1200567 100644 --- a/lib/backup/remove_specified/remove_heavy_data.rb +++ b/lib/backup/remove_specified/remove_heavy_data.rb @@ -17,30 +17,30 @@ def remove_heavy_data_for_repos_owned_by(owner_id, owner_type) end def remove_heavy_data_for_repo(repository) - remove_repo_builds(repository) + # remove_repo_builds(repository) remove_repo_requests(repository) end - def remove_repo_builds(repository) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength - threshold = @config.threshold.to_i.months.ago.to_datetime - builds_to_remove = repository.builds.where('created_at < ?', threshold) + # def remove_repo_builds(repository) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength + # threshold = @config.threshold.to_i.months.ago.to_datetime + # builds_to_remove = repository.builds.where('created_at < ?', threshold) - builds_dependencies = builds_to_remove.map do |build| - result = build.ids_of_all_dependencies(dependencies_to_filter, :without_parents) - result.add(:build, build.id) - result - end.compact + # builds_dependencies = builds_to_remove.map do |build| + # result = build.ids_of_all_dependencies(dependencies_to_filter, :without_parents) + # result.add(:build, build.id) + # result + # end.compact - ids_to_remove = IdHash.join(*builds_dependencies) - @subfolder = "repository_#{repository.id}_old_builds_#{current_time_for_subfolder}" + # ids_to_remove = IdHash.join(*builds_dependencies) + # @subfolder = "repository_#{repository.id}_old_builds_#{current_time_for_subfolder}" - unless @config.dry_run - nullified_rels = builds_to_remove&.map(&:nullify_default_dependencies)&.flatten - save_nullified_rels_to_file(build: nullified_rels) if @config.if_backup - end + # unless @config.dry_run + # nullified_rels = builds_to_remove&.map(&:nullify_default_dependencies)&.flatten + # save_nullified_rels_to_file(build: nullified_rels) if @config.if_backup + # end - process_ids_to_remove(ids_to_remove) - end + # process_ids_to_remove(ids_to_remove) + # end def remove_repo_requests(repository) threshold = @config.threshold.to_i.months.ago.to_datetime @@ -61,11 +61,81 @@ def remove_repo_requests(repository) end ids_to_remove = IdHash.join(*(requests_dependencies)) + orphaned_ids = orphaned_configs_to_remove(repository, ids_to_remove) + ids_to_remove.join(orphaned_ids) process_ids_to_remove(ids_to_remove) end private + def orphaned_configs_to_remove(repository, ids_to_remove) + if ids_to_remove[:request] + request_config_ids = RequestConfig.find_by_sql(%{ + select a.id + from request_configs as a + left join requests as b on + a.id = b.config_id and b.id not in (#{ids_to_remove[:request].join(', ')}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + + request_yaml_config_ids = RequestYamlConfig.find_by_sql(%{ + select a.id + from request_yaml_configs as a + left join requests as b on + a.id = b.yaml_config_id and b.id not in (#{ids_to_remove[:request].join(', ')}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + end + + if ids_to_remove[:request_raw_configuration] + request_raw_config_ids = RequestRawConfig.find_by_sql(%{ + select a.id + from request_raw_configs as a + left join request_raw_configurations as b on + a.id = b.request_raw_config_id and b.id not in (#{ids_to_remove[:request_raw_configuration].join(', ')}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + end + + if ids_to_remove[:build] + build_config_ids = BuildConfig.find_by_sql(%{ + select a.id + from build_configs as a + left join builds as b on + a.id = b.config_id and b.id not in (#{ids_to_remove[:build].join(', ')}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + end + + if ids_to_remove[:job] + job_config_ids = JobConfig.find_by_sql(%{ + select a.id + from job_configs as a + left join jobs as b on + a.id = b.config_id and b.id not in (#{ids_to_remove[:job].join(', ')}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + end + + orphaned_ids = IdHash.new + orphaned_ids.add(:request_config, *request_config_ids) + orphaned_ids.add(:request_yaml_config, *request_yaml_config_ids) + orphaned_ids.add(:request_raw_config, *request_raw_config_ids) + orphaned_ids.add(:build_config, *build_config_ids) + orphaned_ids.add(:job_config, *job_config_ids) + orphaned_ids + end + def process_ids_to_remove(ids_to_remove) if @config.dry_run @dry_run_reporter.add_to_report(ids_to_remove.with_table_symbols) diff --git a/lib/backup/save_id_hash_to_file.rb b/lib/backup/save_id_hash_to_file.rb index 7347f1d..9ef1913 100644 --- a/lib/backup/save_id_hash_to_file.rb +++ b/lib/backup/save_id_hash_to_file.rb @@ -13,7 +13,6 @@ def save_id_hash_to_file(id_hash) def save_ids_batch_to_file(name, ids_batch) model = Model.get_model(name) - export = {} export[:table_name] = model.table_name export[:data] = ids_batch.map do |id| diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index a6c73b0..f074483 100644 --- a/spec/backup/remove_specified_spec.rb +++ b/spec/backup/remove_specified_spec.rb @@ -29,10 +29,10 @@ FactoryBot.create(:repository) } - it 'processes repository builds' do - expect(remove_specified).to receive(:remove_repo_builds).once.with(repository) - remove_specified.remove_heavy_data_for_repo(repository) - end + # it 'processes repository builds' do + # expect(remove_specified).to receive(:remove_repo_builds).once.with(repository) + # remove_specified.remove_heavy_data_for_repo(repository) + # end it 'processes repository requests' do expect(remove_specified).to receive(:remove_repo_requests).once.with(repository) @@ -40,100 +40,100 @@ end end - describe 'remove_repo_builds' do - before(:each) do - BeforeTests.new.run - end - - let!(:repository) { - FactoryBot.rewind_sequences - - db_helper.do_without_triggers do - FactoryBot.create( - :repository_for_removing_heavy_data, - created_at: datetime, - updated_at: datetime - ) - end - } - - shared_context 'removing builds with dependencies' do - it 'removes builds with all its dependencies' do - dependency_tree = repository.dependency_tree - remove_specified.remove_repo_builds(repository) - expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_builds) - end - - it 'removes intended number of rows from the database' do - expect { - remove_specified.remove_repo_builds(repository) - }.to change { Model.sum_of_subclasses_rows }.by(-40) - end - - it 'nullifies orphaned builds dependencies' do - expect( - nullifies_all_orphaned_builds_dependencies? do - remove_specified.remove_repo_builds(repository) - end - ).to eql(true) - end - end - - shared_context 'not saving files' do - it 'does not save files' do - expect_any_instance_of(File).not_to receive(:write) - remove_specified.remove_repo_builds(repository) - end - end - - context 'when if_backup config is set to true' do - it_behaves_like 'removing builds with dependencies' - - it 'saves removed data to files in proper format' do - expect_method_calls_on( - File, :write, - get_expected_files('remove_repo_builds', datetime), - allow_instances: true, - arguments_to_check: :first - ) do - remove_specified.remove_repo_builds(repository) - end - end - - context 'when path with nonexistent folders is given' do - let(:random_files_location) { "dump/tests/#{rand(100000)}" } - let!(:config) { Config.new(files_location: random_files_location, limit: 2) } - let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } - - it 'creates needed folders' do - path_regexp = Regexp.new("#{random_files_location}/.+") - expect(FileUtils).to receive(:mkdir_p).once.with(path_regexp).and_call_original - remove_specified.remove_repo_builds(repository) - end - end - end - - context 'when if_backup config is set to false' do - let!(:config) { Config.new(files_location: files_location, limit: 2, if_backup: false) } - let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } - - it_behaves_like 'not saving files' - it_behaves_like 'removing builds with dependencies' - end - - context 'when dry_run config is set to true' do - let!(:config) { Config.new(files_location: files_location, limit: 2, dry_run: true) } - let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } - - it_behaves_like 'not saving files' - - it 'does not remove entries from db' do - expect { - remove_specified.remove_repo_builds(repository) - }.not_to change { Model.sum_of_subclasses_rows } - end - end - end + # describe 'remove_repo_builds' do + # before(:each) do + # BeforeTests.new.run + # end + + # let!(:repository) { + # FactoryBot.rewind_sequences + + # db_helper.do_without_triggers do + # FactoryBot.create( + # :repository_for_removing_heavy_data, + # created_at: datetime, + # updated_at: datetime + # ) + # end + # } + + # shared_context 'removing builds with dependencies' do + # it 'removes builds with all its dependencies' do + # dependency_tree = repository.dependency_tree + # remove_specified.remove_repo_builds(repository) + # expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_builds) + # end + + # it 'removes intended number of rows from the database' do + # expect { + # remove_specified.remove_repo_builds(repository) + # }.to change { Model.sum_of_subclasses_rows }.by(-40) + # end + + # it 'nullifies orphaned builds dependencies' do + # expect( + # nullifies_all_orphaned_builds_dependencies? do + # remove_specified.remove_repo_builds(repository) + # end + # ).to eql(true) + # end + # end + + # shared_context 'not saving files' do + # it 'does not save files' do + # expect_any_instance_of(File).not_to receive(:write) + # remove_specified.remove_repo_builds(repository) + # end + # end + + # context 'when if_backup config is set to true' do + # it_behaves_like 'removing builds with dependencies' + + # it 'saves removed data to files in proper format' do + # expect_method_calls_on( + # File, :write, + # get_expected_files('remove_repo_builds', datetime), + # allow_instances: true, + # arguments_to_check: :first + # ) do + # remove_specified.remove_repo_builds(repository) + # end + # end + + # context 'when path with nonexistent folders is given' do + # let(:random_files_location) { "dump/tests/#{rand(100000)}" } + # let!(:config) { Config.new(files_location: random_files_location, limit: 2) } + # let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } + + # it 'creates needed folders' do + # path_regexp = Regexp.new("#{random_files_location}/.+") + # expect(FileUtils).to receive(:mkdir_p).once.with(path_regexp).and_call_original + # remove_specified.remove_repo_builds(repository) + # end + # end + # end + + # context 'when if_backup config is set to false' do + # let!(:config) { Config.new(files_location: files_location, limit: 2, if_backup: false) } + # let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } + + # it_behaves_like 'not saving files' + # it_behaves_like 'removing builds with dependencies' + # end + + # context 'when dry_run config is set to true' do + # let!(:config) { Config.new(files_location: files_location, limit: 2, dry_run: true) } + # let!(:remove_specified) { Backup::RemoveSpecified.new(config, DryRunReporter.new) } + + # it_behaves_like 'not saving files' + + # it 'does not remove entries from db' do + # expect { + # remove_specified.remove_repo_builds(repository) + # }.not_to change { Model.sum_of_subclasses_rows } + # end + # end + # end describe 'remove_repo_requests' do before(:each) do @@ -154,6 +154,7 @@ it 'removes requests with all its dependencies' do dependency_tree = repository.dependency_tree remove_specified.remove_repo_requests(repository) + # puts JSON.pretty_generate dependency_tree.status_tree_condensed expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_requests) end diff --git a/spec/support/expected_dependency_trees/remove_repo_requests.rb b/spec/support/expected_dependency_trees/remove_repo_requests.rb index 4eee418..0e8e370 100644 --- a/spec/support/expected_dependency_trees/remove_repo_requests.rb +++ b/spec/support/expected_dependency_trees/remove_repo_requests.rb @@ -891,6 +891,78 @@ def self.remove_repo_requests ] }, "id 36, removed", + { + "_": "id 37, removed", + "abuse": [ + "id 33, removed", + "id 34, removed" + ], + "message": [ + "id 33, removed", + "id 34, removed" + ], + "job": [ + { + "_": "id 176, removed", + "queueable_job": [ + "id 61, removed", + "id 62, removed" + ], + "job_version": [ + "id 61, removed", + "id 62, removed" + ] + }, + "id 177, removed" + ], + "build": [ + { + "_": "id 173, removed", + "job": [ + "id 174, removed" + ], + "repository": [ + "id 71, present", + "id 70, present" + ], + "tag": [ + "id 41, present" + ], + "branch": [ + "id 41, present" + ], + "stage": [ + "id 37, removed" + ] + }, + "id 175, removed" + ], + "request_payload": [ + "id 33, removed", + "id 34, removed" + ], + "request_raw_configuration": [ + "id 35, removed", + "id 36, removed" + ], + "deleted_job": [ + "id 57, removed", + "id 58, removed" + ], + "deleted_build": [ + "id 63, removed", + "id 64, removed" + ], + "deleted_request_payload": [ + "id 33, removed", + "id 34, removed" + ], + "deleted_request_raw_configuration": [ + "id 35, removed", + "id 36, removed" + ] + }, + "id 38, removed", "id 39, removed", "id 40, present" ], @@ -2287,7 +2359,7 @@ def self.remove_repo_requests "id 60, present" ] }, - "id 2, present" + "id 2, removed" ], "email_unsubscribe": [ "id 1, present", @@ -2295,7 +2367,7 @@ def self.remove_repo_requests ], "request_config": [ { - "_": "id 1, present", + "_": "id 1, removed", "request": [ "id 35, removed, duplicate", "id 36, removed, duplicate" @@ -2305,7 +2377,7 @@ def self.remove_repo_requests "id 30, present" ] }, - "id 2, present" + "id 2, removed" ], "job_config": [ { @@ -2319,7 +2391,7 @@ def self.remove_repo_requests "id 56, present" ] }, - "id 2, present" + "id 2, removed" ], "request_raw_config": [ { @@ -2333,7 +2405,7 @@ def self.remove_repo_requests "id 34, present" ] }, - "id 2, present" + "id 2, removed" ], "repo_count": [ "id 1, present", @@ -2341,87 +2413,17 @@ def self.remove_repo_requests ], "request_yaml_config": [ { - "_": "id 1, present", + "_": "id 1, removed", "request": [ - { - "_": "id 37, present", - "abuse": [ - "id 33, present", - "id 34, present" - ], - "message": [ - "id 33, present", - "id 34, present" - ], - "job": [ - { - "_": "id 176, present", - "queueable_job": [ - "id 61, present", - "id 62, present" - ], - "job_version": [ - "id 61, present", - "id 62, present" - ] - }, - "id 177, present" - ], - "build": [ - { - "_": "id 173, present", - "job": [ - "id 174, present" - ], - "repository": [ - "id 71, present", - "id 70, present" - ], - "tag": [ - "id 41, present" - ], - "branch": [ - "id 41, present" - ], - "stage": [ - "id 37, present" - ] - }, - "id 175, present" - ], - "request_payload": [ - "id 33, present", - "id 34, present" - ], - "request_raw_configuration": [ - "id 35, present", - "id 36, present" - ], - "deleted_job": [ - "id 57, present", - "id 58, present" - ], - "deleted_build": [ - "id 63, present", - "id 64, present" - ], - "deleted_request_payload": [ - "id 33, present", - "id 34, present" - ], - "deleted_request_raw_configuration": [ - "id 35, present", - "id 36, present" - ] - }, - "id 38, present" + "id 37, removed, duplicate", + "id 38, removed, duplicate" ], "deleted_request": [ "id 31, present", "id 32, present" ] }, - "id 2, present" + "id 2, removed" ], "deleted_build": [ "id 65, present", diff --git a/spec/support/expected_files/remove_repo_requests/abuse_9-10.json b/spec/support/expected_files/remove_repo_requests/abuse_9-10.json deleted file mode 100644 index 478a336..0000000 --- a/spec/support/expected_files/remove_repo_requests/abuse_9-10.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "table_name": "abuses", - "data": [ - { - "id": 9, - "owner_type": null, - "owner_id": null, - "request_id": 11, - "level": 9, - "reason": "some text", - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC" - }, - { - "id": 10, - "owner_type": null, - "owner_id": null, - "request_id": 11, - "level": 10, - "reason": "some text", - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC" - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_52-54.json b/spec/support/expected_files/remove_repo_requests/build_52-54.json deleted file mode 100644 index 10c52ed..0000000 --- a/spec/support/expected_files/remove_repo_requests/build_52-54.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "table_name": "builds", - "data": [ - { - "id": 52, - "repository_id": null, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": 11, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - }, - { - "id": 54, - "repository_id": null, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": 11, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_17-18.json b/spec/support/expected_files/remove_repo_requests/deleted_build_17-18.json deleted file mode 100644 index f54dae4..0000000 --- a/spec/support/expected_files/remove_repo_requests/deleted_build_17-18.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "table_name": "deleted_builds", - "data": [ - { - "id": 17, - "repository_id": null, - "number": null, - "started_at": null, - "finished_at": null, - "log": null, - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": 11, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - }, - { - "id": 18, - "repository_id": null, - "number": null, - "started_at": null, - "finished_at": null, - "log": null, - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": 11, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_16-17.json b/spec/support/expected_files/remove_repo_requests/deleted_job_16-17.json deleted file mode 100644 index ace0fa1..0000000 --- a/spec/support/expected_files/remove_repo_requests/deleted_job_16-17.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "table_name": "deleted_jobs", - "data": [ - { - "id": 16, - "repository_id": null, - "commit_id": null, - "source_type": "Request", - "source_id": 11, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": null, - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "tags": null, - "allow_failure": null, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 17, - "repository_id": null, - "commit_id": null, - "source_type": "Request", - "source_id": 11, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": null, - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "tags": null, - "allow_failure": null, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-10.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-10.json deleted file mode 100644 index dc70735..0000000 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-10.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "table_name": "deleted_request_payloads", - "data": [ - { - "id": 9, - "request_id": 11, - "payload": null, - "archived": null, - "created_at": "2021-08-23 21:08:48 UTC", - "org_id": null - }, - { - "id": 10, - "request_id": 11, - "payload": null, - "archived": null, - "created_at": "2021-08-23 21:08:48 UTC", - "org_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-10.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-10.json deleted file mode 100644 index 3fccba5..0000000 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-10.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "table_name": "deleted_request_raw_configurations", - "data": [ - { - "id": 9, - "request_id": 11, - "request_raw_config_id": null, - "source": null, - "org_id": null, - "merge_mode": null - }, - { - "id": 10, - "request_id": 11, - "request_raw_config_id": null, - "source": null, - "org_id": null, - "merge_mode": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_53-56.json b/spec/support/expected_files/remove_repo_requests/job_53-56.json deleted file mode 100644 index fc9992c..0000000 --- a/spec/support/expected_files/remove_repo_requests/job_53-56.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "table_name": "jobs", - "data": [ - { - "id": 53, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 52, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 55, - "repository_id": null, - "commit_id": null, - "source_type": "Request", - "source_id": 11, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 56, - "repository_id": null, - "commit_id": null, - "source_type": "Request", - "source_id": 11, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_version_17-18.json b/spec/support/expected_files/remove_repo_requests/job_version_17-18.json deleted file mode 100644 index 09cc013..0000000 --- a/spec/support/expected_files/remove_repo_requests/job_version_17-18.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "table_name": "job_versions", - "data": [ - { - "id": 17, - "job_id": 55, - "number": null, - "state": null, - "created_at": "2021-08-23 21:08:48 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - }, - { - "id": 18, - "job_id": 55, - "number": null, - "state": null, - "created_at": "2021-08-23 21:08:48 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/message_9-10.json b/spec/support/expected_files/remove_repo_requests/message_9-10.json deleted file mode 100644 index bad7ef3..0000000 --- a/spec/support/expected_files/remove_repo_requests/message_9-10.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "table_name": "messages", - "data": [ - { - "id": 9, - "subject_id": 11, - "subject_type": "Request", - "level": null, - "key": null, - "code": null, - "args": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "type": null, - "src": null, - "line": null - }, - { - "id": 10, - "subject_id": 11, - "subject_type": "Request", - "level": null, - "key": null, - "code": null, - "args": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "type": null, - "src": null, - "line": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/queueable_job_17-18.json b/spec/support/expected_files/remove_repo_requests/queueable_job_17-18.json deleted file mode 100644 index 56fd549..0000000 --- a/spec/support/expected_files/remove_repo_requests/queueable_job_17-18.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "table_name": "queueable_jobs", - "data": [ - { - "id": 17, - "job_id": 55 - }, - { - "id": 18, - "job_id": 55 - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_11-39.json b/spec/support/expected_files/remove_repo_requests/request_11-39.json deleted file mode 100644 index 2c4f88b..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_11-39.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "table_name": "requests", - "data": [ - { - "id": 11, - "repository_id": 1, - "commit_id": null, - "state": null, - "source": null, - "token": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "event_type": null, - "comments_url": null, - "base_commit": null, - "head_commit": null, - "owner_type": null, - "owner_id": null, - "result": null, - "message": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "yaml_config_id": null, - "github_guid": null, - "pull_request_mergeable": null - }, - { - "id": 12, - "repository_id": 1, - "commit_id": null, - "state": null, - "source": null, - "token": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "event_type": null, - "comments_url": null, - "base_commit": null, - "head_commit": null, - "owner_type": null, - "owner_id": null, - "result": null, - "message": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "yaml_config_id": null, - "github_guid": null, - "pull_request_mergeable": null - }, - { - "id": 39, - "repository_id": 1, - "commit_id": null, - "state": null, - "source": null, - "token": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08:48 UTC", - "event_type": null, - "comments_url": null, - "base_commit": null, - "head_commit": null, - "owner_type": null, - "owner_id": null, - "result": null, - "message": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "yaml_config_id": null, - "github_guid": null, - "pull_request_mergeable": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_9-10.json b/spec/support/expected_files/remove_repo_requests/request_payload_9-10.json deleted file mode 100644 index 7fb4623..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_payload_9-10.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "table_name": "request_payloads", - "data": [ - { - "id": 9, - "request_id": 11, - "payload": null, - "archived": false, - "created_at": "2021-08-23 21:08:48 UTC", - "org_id": null - }, - { - "id": 10, - "request_id": 11, - "payload": null, - "archived": false, - "created_at": "2021-08-23 21:08:48 UTC", - "org_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-10.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-10.json deleted file mode 100644 index 2afca89..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-10.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "table_name": "request_raw_configurations", - "data": [ - { - "id": 9, - "request_id": 11, - "request_raw_config_id": null, - "source": null, - "org_id": null, - "merge_mode": null - }, - { - "id": 10, - "request_id": 11, - "request_raw_config_id": null, - "source": null, - "org_id": null, - "merge_mode": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/stage_12-12.json b/spec/support/expected_files/remove_repo_requests/stage_12-12.json deleted file mode 100644 index bb598e4..0000000 --- a/spec/support/expected_files/remove_repo_requests/stage_12-12.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "table_name": "stages", - "data": [ - { - "id": 12, - "build_id": 52, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index 906c6c7..95d5e7f 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -142,11 +142,13 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) end end - repository.request_raw_configs.each do |config| - config.requests.each do |request| - request.update(repository_id: repository.id) - end - end + # repository.request_raw_configs.each do |config| + # config.request_raw_configurations.each do |configuration| + # configuration.requests.each do |request| + # request.update(repository_id: repository.id) + # end + # end + # end repository.request_yaml_configs.each do |config| config.requests.each do |request| From 462910310165eee27b7d0bd4bc2b37936f2b10bb Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Wed, 27 Apr 2022 09:05:06 +0200 Subject: [PATCH 07/11] removing configs wip --- .../remove_repo_requests/abuse_34-34.json | 15 ++ .../remove_repo_requests/abuse_9-33.json | 55 +++++ .../remove_repo_requests/build_175-175.json | 50 ++++ .../remove_repo_requests/build_52-173.json | 230 ++++++++++++++++++ .../build_config_2-2.json | 13 + .../deleted_build_17-63.json | 230 ++++++++++++++++++ .../deleted_build_64-64.json | 50 ++++ .../deleted_job_16-57.json | 175 +++++++++++++ .../deleted_job_58-58.json | 39 +++ .../deleted_request_payload_34-34.json | 13 + .../deleted_request_payload_9-33.json | 45 ++++ ...leted_request_raw_configuration_36-36.json | 13 + ...eleted_request_raw_configuration_9-35.json | 45 ++++ .../remove_repo_requests/job_170-177.json | 141 +++++++++++ .../remove_repo_requests/job_53-169.json | 175 +++++++++++++ .../remove_repo_requests/job_config_2-2.json | 13 + .../job_version_17-61.json | 65 +++++ .../job_version_62-62.json | 17 ++ .../remove_repo_requests/message_34-34.json | 19 ++ .../remove_repo_requests/message_9-33.json | 75 ++++++ .../nullified_relationships/build_2.json | 3 + .../nullified_relationships/build_3.json | 3 + .../queueable_job_17-61.json | 25 ++ .../queueable_job_62-62.json | 9 + .../remove_repo_requests/request_11-37.json | 165 +++++++++++++ .../remove_repo_requests/request_38-39.json | 69 ++++++ .../request_config_1-2.json | 21 ++ .../request_payload_34-34.json | 13 + .../request_payload_9-33.json | 45 ++++ .../request_raw_config_2-2.json | 12 + .../request_raw_configuration_36-36.json | 13 + .../request_raw_configuration_9-35.json | 45 ++++ .../request_yaml_config_1-2.json | 21 ++ .../remove_repo_requests/stage_12-37.json | 38 +++ 34 files changed, 1960 insertions(+) create mode 100644 spec/support/expected_files/remove_repo_requests/abuse_34-34.json create mode 100644 spec/support/expected_files/remove_repo_requests/abuse_9-33.json create mode 100644 spec/support/expected_files/remove_repo_requests/build_175-175.json create mode 100644 spec/support/expected_files/remove_repo_requests/build_52-173.json create mode 100644 spec/support/expected_files/remove_repo_requests/build_config_2-2.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json create mode 100644 spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json create mode 100644 spec/support/expected_files/remove_repo_requests/job_170-177.json create mode 100644 spec/support/expected_files/remove_repo_requests/job_53-169.json create mode 100644 spec/support/expected_files/remove_repo_requests/job_config_2-2.json create mode 100644 spec/support/expected_files/remove_repo_requests/job_version_17-61.json create mode 100644 spec/support/expected_files/remove_repo_requests/job_version_62-62.json create mode 100644 spec/support/expected_files/remove_repo_requests/message_34-34.json create mode 100644 spec/support/expected_files/remove_repo_requests/message_9-33.json create mode 100644 spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json create mode 100644 spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json create mode 100644 spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json create mode 100644 spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_11-37.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_38-39.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_config_1-2.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_payload_34-34.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_payload_9-33.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json create mode 100644 spec/support/expected_files/remove_repo_requests/stage_12-37.json diff --git a/spec/support/expected_files/remove_repo_requests/abuse_34-34.json b/spec/support/expected_files/remove_repo_requests/abuse_34-34.json new file mode 100644 index 0000000..8aeb3ba --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/abuse_34-34.json @@ -0,0 +1,15 @@ +{ + "table_name": "abuses", + "data": [ + { + "id": 34, + "owner_type": null, + "owner_id": null, + "request_id": 37, + "level": 34, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_9-33.json b/spec/support/expected_files/remove_repo_requests/abuse_9-33.json new file mode 100644 index 0000000..c655330 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/abuse_9-33.json @@ -0,0 +1,55 @@ +{ + "table_name": "abuses", + "data": [ + { + "id": 9, + "owner_type": null, + "owner_id": null, + "request_id": 11, + "level": 9, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + }, + { + "id": 10, + "owner_type": null, + "owner_id": null, + "request_id": 11, + "level": 10, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + }, + { + "id": 31, + "owner_type": null, + "owner_id": null, + "request_id": 35, + "level": 31, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + }, + { + "id": 32, + "owner_type": null, + "owner_id": null, + "request_id": 35, + "level": 32, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + }, + { + "id": 33, + "owner_type": null, + "owner_id": null, + "request_id": 37, + "level": 33, + "reason": "some text", + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC" + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_175-175.json b/spec/support/expected_files/remove_repo_requests/build_175-175.json new file mode 100644 index 0000000..2a24f6c --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/build_175-175.json @@ -0,0 +1,50 @@ +{ + "table_name": "builds", + "data": [ + { + "id": 175, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 37, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_52-173.json b/spec/support/expected_files/remove_repo_requests/build_52-173.json new file mode 100644 index 0000000..23dcb94 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/build_52-173.json @@ -0,0 +1,230 @@ +{ + "table_name": "builds", + "data": [ + { + "id": 52, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 11, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 54, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 11, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 166, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 35, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 168, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 35, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 173, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": "", + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 37, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_config_2-2.json b/spec/support/expected_files/remove_repo_requests/build_config_2-2.json new file mode 100644 index 0000000..49685e2 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/build_config_2-2.json @@ -0,0 +1,13 @@ +{ + "table_name": "build_configs", + "data": [ + { + "id": 2, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null, + "config": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json b/spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json new file mode 100644 index 0000000..40b5abc --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json @@ -0,0 +1,230 @@ +{ + "table_name": "deleted_builds", + "data": [ + { + "id": 17, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 11, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 18, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 11, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 61, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 35, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 62, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 35, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + }, + { + "id": 63, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 37, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json b/spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json new file mode 100644 index 0000000..07e0969 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json @@ -0,0 +1,50 @@ +{ + "table_name": "deleted_builds", + "data": [ + { + "id": 64, + "repository_id": null, + "number": null, + "started_at": null, + "finished_at": null, + "log": null, + "message": null, + "committed_at": null, + "committer_name": null, + "committer_email": null, + "author_name": null, + "author_email": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 37, + "state": null, + "duration": null, + "owner_type": null, + "owner_id": null, + "event_type": null, + "previous_state": null, + "pull_request_title": null, + "pull_request_number": null, + "canceled_at": null, + "cached_matrix_ids": null, + "received_at": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "unique_number": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json b/spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json new file mode 100644 index 0000000..4832e59 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json @@ -0,0 +1,175 @@ +{ + "table_name": "deleted_jobs", + "data": [ + { + "id": 16, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 11, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 17, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 11, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 53, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 35, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 54, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 35, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 57, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 37, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json b/spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json new file mode 100644 index 0000000..9d7a425 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json @@ -0,0 +1,39 @@ +{ + "table_name": "deleted_jobs", + "data": [ + { + "id": 58, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 37, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": null, + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": null, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json new file mode 100644 index 0000000..e76f28e --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json @@ -0,0 +1,13 @@ +{ + "table_name": "deleted_request_payloads", + "data": [ + { + "id": 34, + "request_id": 37, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json new file mode 100644 index 0000000..80fdbba --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json @@ -0,0 +1,45 @@ +{ + "table_name": "deleted_request_payloads", + "data": [ + { + "id": 9, + "request_id": 11, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 10, + "request_id": 11, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 31, + "request_id": 35, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 32, + "request_id": 35, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 33, + "request_id": 37, + "payload": null, + "archived": null, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json new file mode 100644 index 0000000..58bb5e3 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json @@ -0,0 +1,13 @@ +{ + "table_name": "deleted_request_raw_configurations", + "data": [ + { + "id": 36, + "request_id": 37, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json new file mode 100644 index 0000000..0d6310c --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json @@ -0,0 +1,45 @@ +{ + "table_name": "deleted_request_raw_configurations", + "data": [ + { + "id": 9, + "request_id": 11, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 10, + "request_id": 11, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 31, + "request_id": 35, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 32, + "request_id": 35, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 35, + "request_id": 37, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_170-177.json b/spec/support/expected_files/remove_repo_requests/job_170-177.json new file mode 100644 index 0000000..45fc37a --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/job_170-177.json @@ -0,0 +1,141 @@ +{ + "table_name": "jobs", + "data": [ + { + "id": 170, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 35, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 174, + "repository_id": null, + "commit_id": null, + "source_type": "Build", + "source_id": 173, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 176, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 37, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 177, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 37, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_53-169.json b/spec/support/expected_files/remove_repo_requests/job_53-169.json new file mode 100644 index 0000000..8f2e013 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/job_53-169.json @@ -0,0 +1,175 @@ +{ + "table_name": "jobs", + "data": [ + { + "id": 53, + "repository_id": null, + "commit_id": null, + "source_type": "Build", + "source_id": 52, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 55, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 11, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 56, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 11, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 167, + "repository_id": null, + "commit_id": null, + "source_type": "Build", + "source_id": 166, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + }, + { + "id": 169, + "repository_id": null, + "commit_id": null, + "source_type": "Request", + "source_id": 35, + "queue": null, + "type": null, + "state": null, + "number": null, + "log": "", + "worker": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "tags": null, + "allow_failure": false, + "owner_type": null, + "owner_id": null, + "result": null, + "queued_at": null, + "canceled_at": null, + "received_at": null, + "debug_options": null, + "private": null, + "stage_number": null, + "stage_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "restarted_at": null, + "priority": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_config_2-2.json b/spec/support/expected_files/remove_repo_requests/job_config_2-2.json new file mode 100644 index 0000000..98d2d1e --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/job_config_2-2.json @@ -0,0 +1,13 @@ +{ + "table_name": "job_configs", + "data": [ + { + "id": 2, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null, + "config": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_version_17-61.json b/spec/support/expected_files/remove_repo_requests/job_version_17-61.json new file mode 100644 index 0000000..1eb8e6d --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/job_version_17-61.json @@ -0,0 +1,65 @@ +{ + "table_name": "job_versions", + "data": [ + { + "id": 17, + "job_id": 55, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + }, + { + "id": 18, + "job_id": 55, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + }, + { + "id": 57, + "job_id": 169, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + }, + { + "id": 58, + "job_id": 169, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + }, + { + "id": 61, + "job_id": 176, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_version_62-62.json b/spec/support/expected_files/remove_repo_requests/job_version_62-62.json new file mode 100644 index 0000000..07b53c8 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/job_version_62-62.json @@ -0,0 +1,17 @@ +{ + "table_name": "job_versions", + "data": [ + { + "id": 62, + "job_id": 176, + "number": null, + "state": null, + "created_at": "2021-09-27 06:59:20 UTC", + "queued_at": null, + "received_at": null, + "started_at": null, + "finished_at": null, + "restarted_at": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/message_34-34.json b/spec/support/expected_files/remove_repo_requests/message_34-34.json new file mode 100644 index 0000000..73c17c8 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/message_34-34.json @@ -0,0 +1,19 @@ +{ + "table_name": "messages", + "data": [ + { + "id": 34, + "subject_id": 37, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/message_9-33.json b/spec/support/expected_files/remove_repo_requests/message_9-33.json new file mode 100644 index 0000000..abd073c --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/message_9-33.json @@ -0,0 +1,75 @@ +{ + "table_name": "messages", + "data": [ + { + "id": 9, + "subject_id": 11, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 10, + "subject_id": 11, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 31, + "subject_id": 35, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 32, + "subject_id": 35, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 33, + "subject_id": 37, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "type": null, + "src": null, + "line": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json new file mode 100644 index 0000000..83fb8fc --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json @@ -0,0 +1,3 @@ +{ + "table_name": "builds" +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json new file mode 100644 index 0000000..83fb8fc --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json @@ -0,0 +1,3 @@ +{ + "table_name": "builds" +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json b/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json new file mode 100644 index 0000000..1e11c21 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json @@ -0,0 +1,25 @@ +{ + "table_name": "queueable_jobs", + "data": [ + { + "id": 17, + "job_id": 55 + }, + { + "id": 18, + "job_id": 55 + }, + { + "id": 57, + "job_id": 169 + }, + { + "id": 58, + "job_id": 169 + }, + { + "id": 61, + "job_id": 176 + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json b/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json new file mode 100644 index 0000000..52e24dc --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json @@ -0,0 +1,9 @@ +{ + "table_name": "queueable_jobs", + "data": [ + { + "id": 62, + "job_id": 176 + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_11-37.json b/spec/support/expected_files/remove_repo_requests/request_11-37.json new file mode 100644 index 0000000..4590b1f --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_11-37.json @@ -0,0 +1,165 @@ +{ + "table_name": "requests", + "data": [ + { + "id": 11, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 12, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 35, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2022-04-27 06:59:25 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": 1, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 36, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2022-04-27 06:59:25 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": 1, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 37, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2022-04-27 06:59:25 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": 1, + "github_guid": null, + "pull_request_mergeable": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_38-39.json b/spec/support/expected_files/remove_repo_requests/request_38-39.json new file mode 100644 index 0000000..45c0ce1 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_38-39.json @@ -0,0 +1,69 @@ +{ + "table_name": "requests", + "data": [ + { + "id": 38, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2022-04-27 06:59:25 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": 1, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 39, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-27 06:59:20 UTC", + "updated_at": "2021-09-27 06:59:20 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_config_1-2.json b/spec/support/expected_files/remove_repo_requests/request_config_1-2.json new file mode 100644 index 0000000..3721f6a --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_config_1-2.json @@ -0,0 +1,21 @@ +{ + "table_name": "request_configs", + "data": [ + { + "id": 1, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null, + "config": null + }, + { + "id": 2, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null, + "config": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_34-34.json b/spec/support/expected_files/remove_repo_requests/request_payload_34-34.json new file mode 100644 index 0000000..36d9ae7 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_payload_34-34.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_payloads", + "data": [ + { + "id": 34, + "request_id": 37, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_9-33.json b/spec/support/expected_files/remove_repo_requests/request_payload_9-33.json new file mode 100644 index 0000000..6918f6b --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_payload_9-33.json @@ -0,0 +1,45 @@ +{ + "table_name": "request_payloads", + "data": [ + { + "id": 9, + "request_id": 11, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 10, + "request_id": 11, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 31, + "request_id": 35, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 32, + "request_id": 35, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + }, + { + "id": 33, + "request_id": 37, + "payload": null, + "archived": false, + "created_at": "2021-09-27 06:59:20 UTC", + "org_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json b/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json new file mode 100644 index 0000000..c2d69f6 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json @@ -0,0 +1,12 @@ +{ + "table_name": "request_raw_configs", + "data": [ + { + "id": 2, + "config": null, + "repository_id": 1, + "key": "some_test_key", + "org_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json new file mode 100644 index 0000000..35c4f03 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_raw_configurations", + "data": [ + { + "id": 36, + "request_id": 37, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json new file mode 100644 index 0000000..fb985bd --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json @@ -0,0 +1,45 @@ +{ + "table_name": "request_raw_configurations", + "data": [ + { + "id": 9, + "request_id": 11, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 10, + "request_id": 11, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 31, + "request_id": 35, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 32, + "request_id": 35, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 35, + "request_id": 37, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json new file mode 100644 index 0000000..568e31b --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json @@ -0,0 +1,21 @@ +{ + "table_name": "request_yaml_configs", + "data": [ + { + "id": 1, + "yaml": null, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null + }, + { + "id": 2, + "yaml": null, + "repository_id": 1, + "key": "some_test_key", + "org_id": null, + "com_id": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/stage_12-37.json b/spec/support/expected_files/remove_repo_requests/stage_12-37.json new file mode 100644 index 0000000..70cb448 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/stage_12-37.json @@ -0,0 +1,38 @@ +{ + "table_name": "stages", + "data": [ + { + "id": 12, + "build_id": 52, + "number": null, + "name": null, + "state": null, + "started_at": null, + "finished_at": null, + "org_id": null, + "com_id": null + }, + { + "id": 36, + "build_id": 166, + "number": null, + "name": null, + "state": null, + "started_at": null, + "finished_at": null, + "org_id": null, + "com_id": null + }, + { + "id": 37, + "build_id": 173, + "number": null, + "name": null, + "state": null, + "started_at": null, + "finished_at": null, + "org_id": null, + "com_id": null + } + ] +} \ No newline at end of file From 0cd3b6ff0935e176b9934e909d80f542ddd11e1e Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Thu, 28 Apr 2022 15:57:17 +0200 Subject: [PATCH 08/11] removing configs wip - new rows number and recording timestamps turned off --- spec/backup/remove_specified_spec.rb | 3 +-- spec/backup_spec.rb | 10 +++++----- spec/support/factories/repository.rb | 5 +++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index f074483..b0c1d24 100644 --- a/spec/backup/remove_specified_spec.rb +++ b/spec/backup/remove_specified_spec.rb @@ -154,7 +154,6 @@ it 'removes requests with all its dependencies' do dependency_tree = repository.dependency_tree remove_specified.remove_repo_requests(repository) - # puts JSON.pretty_generate dependency_tree.status_tree_condensed expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_requests) end @@ -162,7 +161,7 @@ db_helper.do_without_triggers do expect { remove_specified.remove_repo_requests(repository) - }.to change { Model.sum_of_subclasses_rows }.by(-29) + }.to change { Model.sum_of_subclasses_rows }.by(-92) end end diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index 8da2565..a1b641e 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb @@ -18,19 +18,19 @@ describe 'run' do let!(:unassigned_repositories) { - FactoryBot.create_list(:repository_with_requests, 3) + FactoryBot.create_list(:repository, 3) } let!(:user1) { - FactoryBot.create(:user_with_repos) + FactoryBot.create(:user) } let!(:user2) { - FactoryBot.create(:user_with_repos) + FactoryBot.create(:user) } let!(:organization1) { - FactoryBot.create(:organization_with_repos) + FactoryBot.create(:organization) } let!(:organization2) { - FactoryBot.create(:organization_with_repos) + FactoryBot.create(:organization) } context 'when threshold for heavy data is given' do diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index 95d5e7f..4b92677 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -134,6 +134,8 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) create_for_repo(repository, :request) create_for_repo_without_timestamps(repository, :request) + Repository.record_timestamps = false + Request.record_timestamps = false repository.update(last_build_id: last_build.id) repository.request_configs.each do |config| @@ -167,6 +169,9 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) job.update(repository_id: repository.id) end end + + Repository.record_timestamps = true + Request.record_timestamps = true end end end From 1059e483a451f773c2561d5dc062257fe2f7d1de Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Thu, 28 Apr 2022 16:16:00 +0200 Subject: [PATCH 09/11] new repo for heavy data --- spec/backup/remove_specified_spec.rb | 1 + .../remove_repo_requests.rb | 2461 ++--------------- spec/support/factories/repository.rb | 93 +- 3 files changed, 251 insertions(+), 2304 deletions(-) diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index b0c1d24..3925417 100644 --- a/spec/backup/remove_specified_spec.rb +++ b/spec/backup/remove_specified_spec.rb @@ -154,6 +154,7 @@ it 'removes requests with all its dependencies' do dependency_tree = repository.dependency_tree remove_specified.remove_repo_requests(repository) + puts JSON.pretty_generate dependency_tree.status_tree_condensed expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_requests) end diff --git a/spec/support/expected_dependency_trees/remove_repo_requests.rb b/spec/support/expected_dependency_trees/remove_repo_requests.rb index 0e8e370..97066ec 100644 --- a/spec/support/expected_dependency_trees/remove_repo_requests.rb +++ b/spec/support/expected_dependency_trees/remove_repo_requests.rb @@ -4,2377 +4,362 @@ def self.remove_repo_requests "_": "id 1, present", "build": [ { - "_": "id 1, present", + "_": "id 1, removed", "job": [ - { - "_": "id 6, present", - "queueable_job": [ - "id 1, present", - "id 2, present" - ], - "job_version": [ - "id 1, present", - "id 2, present" - ] - }, - "id 7, present", - "id 8, present" + "id 2, removed" ], "repository": [ - { - "_": "id 20, present", - "build": [ - "id 49, present" - ], - "request": [ - "id 10, present" - ], - "job": [ - "id 50, present" - ], - "branch": [ - "id 12, present" - ], - "ssl_key": [ - "id 2, present" - ], - "commit": [ - "id 6, present" - ], - "permission": [ - "id 2, present" - ], - "star": [ - "id 2, present" - ], - "pull_request": [ - "id 2, present" - ], - "tag": [ - "id 12, present" - ] - }, - "id 21, present", - { - "_": "id 18, present", - "build": [ - "id 47, present" - ], - "request": [ - "id 9, present" - ], - "job": [ - "id 48, present" - ], - "branch": [ - "id 11, present" - ], - "ssl_key": [ - "id 1, present" - ], - "commit": [ - "id 5, present" - ], - "permission": [ - "id 1, present" - ], - "star": [ - "id 1, present" - ], - "pull_request": [ - "id 1, present" - ], - "tag": [ - "id 11, present" - ] - }, - "id 19, present" + "id 3, present", + "id 2, present" ], "tag": [ - { - "_": "id 1, present", - "build": [ - { - "_": "id 9, present", - "job": [ - "id 10, present" - ], - "repository": [ - "id 3, present", - "id 2, present" - ], - "tag": [ - "id 2, present" - ], - "branch": [ - "id 1, present" - ], - "stage": [ - "id 4, present" - ] - }, - "id 11, present" - ], - "commit": [ - { - "_": "id 1, present", - "build": [ - { - "_": "id 12, present", - "job": [ - "id 13, present" - ], - "repository": [ - "id 5, present", - "id 4, present" - ], - "tag": [ - "id 3, present" - ], - "branch": [ - "id 2, present" - ], - "stage": [ - "id 5, present" - ] - }, - "id 14, present" - ], - "job": [ - { - "_": "id 15, present", - "queueable_job": [ - "id 3, present", - "id 4, present" - ], - "job_version": [ - "id 3, present", - "id 4, present" - ] - }, - "id 16, present" - ], - "request": [ - { - "_": "id 1, present", - "abuse": [ - "id 1, present", - "id 2, present" - ], - "message": [ - "id 1, present", - "id 2, present" - ], - "job": [ - { - "_": "id 20, present", - "queueable_job": [ - "id 5, present", - "id 6, present" - ], - "job_version": [ - "id 5, present", - "id 6, present" - ] - }, - "id 21, present" - ], - "build": [ - { - "_": "id 17, present", - "job": [ - "id 18, present" - ], - "repository": [ - "id 7, present", - "id 6, present" - ], - "tag": [ - "id 4, present" - ], - "branch": [ - "id 3, present" - ], - "stage": [ - "id 6, present" - ] - }, - "id 19, present" - ], - "request_payload": [ - "id 1, present", - "id 2, present" - ], - "request_raw_configuration": [ - "id 1, present", - "id 2, present" - ], - "deleted_job": [ - "id 1, present", - "id 2, present" - ], - "deleted_build": [ - "id 1, present", - "id 2, present" - ], - "deleted_request_payload": [ - "id 1, present", - "id 2, present" - ], - "deleted_request_raw_configuration": [ - "id 1, present", - "id 2, present" - ] - }, - "id 2, present" - ], - "deleted_build": [ - "id 3, present", - "id 4, present" - ], - "deleted_job": [ - "id 3, present", - "id 4, present" - ], - "deleted_request": [ - "id 1, present", - "id 2, present" - ] - }, - "id 2, present" - ], - "request": [ - { - "_": "id 3, present", - "abuse": [ - "id 3, present", - "id 4, present" - ], - "message": [ - "id 3, present", - "id 4, present" - ], - "job": [ - { - "_": "id 25, present", - "queueable_job": [ - "id 7, present", - "id 8, present" - ], - "job_version": [ - "id 7, present", - "id 8, present" - ] - }, - "id 26, present" - ], - "build": [ - { - "_": "id 22, present", - "job": [ - "id 23, present" - ], - "repository": [ - "id 9, present", - "id 8, present" - ], - "tag": [ - "id 5, present" - ], - "branch": [ - "id 4, present" - ], - "stage": [ - "id 7, present" - ] - }, - "id 24, present" - ], - "request_payload": [ - "id 3, present", - "id 4, present" - ], - "request_raw_configuration": [ - "id 3, present", - "id 4, present" - ], - "deleted_job": [ - "id 5, present", - "id 6, present" - ], - "deleted_build": [ - "id 5, present", - "id 6, present" - ], - "deleted_request_payload": [ - "id 3, present", - "id 4, present" - ], - "deleted_request_raw_configuration": [ - "id 3, present", - "id 4, present" - ] - }, - "id 4, present" - ], - "deleted_build": [ - "id 7, present", - "id 8, present" - ], - "deleted_commit": [ - "id 1, present", - "id 2, present" - ], - "deleted_request": [ - "id 3, present", - "id 4, present" - ] - }, - "id 6, present" + "id 1, present" ], "branch": [ - { - "_": "id 5, present", - "build": [ - { - "_": "id 27, present", - "job": [ - "id 28, present" - ], - "repository": [ - "id 11, present", - "id 10, present" - ], - "tag": [ - "id 7, present" - ], - "branch": [ - "id 6, present" - ], - "stage": [ - "id 8, present" - ] - }, - "id 29, present" - ], - "commit": [ - { - "_": "id 3, present", - "build": [ - { - "_": "id 32, present", - "job": [ - "id 33, present" - ], - "repository": [ - "id 13, present", - "id 12, present" - ], - "tag": [ - "id 8, present" - ], - "branch": [ - "id 7, present" - ], - "stage": [ - "id 9, present" - ] - }, - "id 34, present" - ], - "job": [ - { - "_": "id 35, present", - "queueable_job": [ - "id 11, present", - "id 12, present" - ], - "job_version": [ - "id 11, present", - "id 12, present" - ] - }, - "id 36, present" - ], - "request": [ - { - "_": "id 5, present", - "abuse": [ - "id 5, present", - "id 6, present" - ], - "message": [ - "id 5, present", - "id 6, present" - ], - "job": [ - { - "_": "id 40, present", - "queueable_job": [ - "id 13, present", - "id 14, present" - ], - "job_version": [ - "id 13, present", - "id 14, present" - ] - }, - "id 41, present" - ], - "build": [ - { - "_": "id 37, present", - "job": [ - "id 38, present" - ], - "repository": [ - "id 15, present", - "id 14, present" - ], - "tag": [ - "id 9, present" - ], - "branch": [ - "id 8, present" - ], - "stage": [ - "id 10, present" - ] - }, - "id 39, present" - ], - "request_payload": [ - "id 5, present", - "id 6, present" - ], - "request_raw_configuration": [ - "id 5, present", - "id 6, present" - ], - "deleted_job": [ - "id 9, present", - "id 10, present" - ], - "deleted_build": [ - "id 11, present", - "id 12, present" - ], - "deleted_request_payload": [ - "id 5, present", - "id 6, present" - ], - "deleted_request_raw_configuration": [ - "id 5, present", - "id 6, present" - ] - }, - "id 6, present" - ], - "deleted_build": [ - "id 13, present", - "id 14, present" - ], - "deleted_job": [ - "id 11, present", - "id 12, present" - ], - "deleted_request": [ - "id 5, present", - "id 6, present" - ] - }, - "id 4, present" - ], - "cron": [ - "id 1, present" - ], - "job": [ - { - "_": "id 30, present", - "queueable_job": [ - "id 9, present", - "id 10, present" - ], - "job_version": [ - "id 9, present", - "id 10, present" - ] - }, - "id 31, present" - ], - "request": [ - { - "_": "id 7, present", - "abuse": [ - "id 7, present", - "id 8, present" - ], - "message": [ - "id 7, present", - "id 8, present" - ], - "job": [ - { - "_": "id 45, present", - "queueable_job": [ - "id 15, present", - "id 16, present" - ], - "job_version": [ - "id 15, present", - "id 16, present" - ] - }, - "id 46, present" - ], - "build": [ - { - "_": "id 42, present", - "job": [ - "id 43, present" - ], - "repository": [ - "id 17, present", - "id 16, present" - ], - "tag": [ - "id 10, present" - ], - "branch": [ - "id 9, present" - ], - "stage": [ - "id 11, present" - ] - }, - "id 44, present" - ], - "request_payload": [ - "id 7, present", - "id 8, present" - ], - "request_raw_configuration": [ - "id 7, present", - "id 8, present" - ], - "deleted_job": [ - "id 13, present", - "id 14, present" - ], - "deleted_build": [ - "id 15, present", - "id 16, present" - ], - "deleted_request_payload": [ - "id 7, present", - "id 8, present" - ], - "deleted_request_raw_configuration": [ - "id 7, present", - "id 8, present" - ] - }, - "id 8, present" - ], - "deleted_build": [ - "id 9, present", - "id 10, present" - ], - "deleted_commit": [ - "id 3, present", - "id 4, present" - ], - "deleted_job": [ - "id 7, present", - "id 8, present" - ], - "deleted_request": [ - "id 7, present", - "id 8, present" - ] - }, - "id 10, present" - ], - "stage": [ - { - "_": "id 1, present", - "job": [ - "id 2, present", - "id 3, present" - ] - }, - { - "_": "id 2, present", - "job": [ - "id 4, present", - "id 5, present" - ] - }, - "id 3, present" - ], - "deleted_job": [ - "id 15, present" - ], - "deleted_tag": [ "id 1, present" ], - "deleted_stage": [ - "id 1, present" + "stage": [ + "id 1, removed" ] }, - "id 51, present", + "id 3, removed", { - "_": "id 163, present", + "_": "id 6, present", "job": [ - "id 164, present" + "id 7, present" ], "repository": [ - "id 67, present", - "id 66, present" + "id 5, present", + "id 4, present" ], "tag": [ - "id 39, present" + "id 2, present" ], "branch": [ - "id 39, present" + "id 2, present" ], "stage": [ - "id 35, present" + "id 2, present" ] }, - "id 165, present", + "id 8, present", { - "_": "id 178, present", + "_": "id 11, present", "job": [ - { - "_": "id 183, present", - "queueable_job": [ - "id 63, present", - "id 64, present" - ], - "job_version": [ - "id 63, present", - "id 64, present" - ] - }, - "id 184, present" + "id 12, present" + ], + "repository": [ + "id 7, present", + "id 6, present" + ], + "tag": [ + "id 3, present" + ], + "branch": [ + "id 3, present" ], "stage": [ - { - "_": "id 38, present", - "job": [ - "id 179, present", - "id 180, present" - ] - }, - { - "_": "id 39, present", - "job": [ - "id 181, present", - "id 182, present" - ] - } + "id 3, present" ] }, + "id 13, present", { - "_": "id 185, present", + "_": "id 14, removed", "job": [ - { - "_": "id 190, present", - "queueable_job": [ - "id 65, present", - "id 66, present" - ], - "job_version": [ - "id 65, present", - "id 66, present" - ] - }, - "id 191, present" + "id 15, removed" + ], + "repository": [ + "id 9, present", + "id 8, present" + ], + "tag": [ + "id 4, present" + ], + "branch": [ + "id 4, present" ], "stage": [ - { - "_": "id 40, present", - "job": [ - "id 186, present", - "id 187, present" - ] - }, - { - "_": "id 41, present", - "job": [ - "id 188, present", - "id 189, present" - ] - } + "id 4, removed" ] }, + "id 16, removed", { - "_": "id 192, present", + "_": "id 21, removed", "job": [ - { - "_": "id 197, present", - "queueable_job": [ - "id 67, present", - "id 68, present" - ], - "job_version": [ - "id 67, present", - "id 68, present" - ] - }, - "id 198, present" + "id 22, removed" ], "repository": [ - "id 1, present, duplicate" + "id 11, present", + "id 10, present" + ], + "tag": [ + "id 5, present" + ], + "branch": [ + "id 5, present" ], "stage": [ - { - "_": "id 42, present", - "job": [ - "id 193, present", - "id 194, present" - ] - }, - { - "_": "id 43, present", - "job": [ - "id 195, present", - "id 196, present" - ] - } + "id 5, removed" ] - } + }, + "id 23, removed" ], "request": [ { - "_": "id 11, removed", + "_": "id 1, removed", "abuse": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ], "message": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ], "job": [ { - "_": "id 55, removed", + "_": "id 4, removed", "queueable_job": [ - "id 17, removed", - "id 18, removed" + "id 1, removed", + "id 2, removed" ], "job_version": [ - "id 17, removed", - "id 18, removed" + "id 1, removed", + "id 2, removed" ] }, - "id 56, removed" + "id 5, removed" ], "build": [ - { - "_": "id 52, removed", - "job": [ - "id 53, removed" - ], - "repository": [ - "id 23, present", - "id 22, present" - ], - "tag": [ - "id 13, present" - ], - "branch": [ - "id 13, present" - ], - "stage": [ - "id 12, removed" - ] - }, - "id 54, removed" + "id 1, removed, duplicate", + "id 3, removed, duplicate" ], "request_payload": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ], "request_raw_configuration": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ], "deleted_job": [ - "id 16, removed", - "id 17, removed" + "id 1, removed", + "id 2, removed" ], "deleted_build": [ - "id 17, removed", - "id 18, removed" + "id 1, removed", + "id 2, removed" ], "deleted_request_payload": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ], "deleted_request_raw_configuration": [ - "id 9, removed", - "id 10, removed" + "id 1, removed", + "id 2, removed" ] }, - "id 12, removed", + "id 2, removed", { - "_": "id 35, removed", + "_": "id 3, present", "abuse": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ], "message": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ], "job": [ { - "_": "id 169, removed", + "_": "id 9, present", "queueable_job": [ - "id 57, removed", - "id 58, removed" + "id 3, present", + "id 4, present" ], "job_version": [ - "id 57, removed", - "id 58, removed" + "id 3, present", + "id 4, present" ] }, - "id 170, removed" + "id 10, present" ], "build": [ - { - "_": "id 166, removed", - "job": [ - "id 167, removed" - ], - "repository": [ - "id 69, present", - "id 68, present" - ], - "tag": [ - "id 40, present" - ], - "branch": [ - "id 40, present" - ], - "stage": [ - "id 36, removed" - ] - }, - "id 168, removed" + "id 6, present, duplicate", + "id 8, present, duplicate" ], "request_payload": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ], "request_raw_configuration": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ], "deleted_job": [ - "id 53, removed", - "id 54, removed" + "id 3, present", + "id 4, present" ], "deleted_build": [ - "id 61, removed", - "id 62, removed" + "id 3, present", + "id 4, present" ], "deleted_request_payload": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ], "deleted_request_raw_configuration": [ - "id 31, removed", - "id 32, removed" + "id 3, present", + "id 4, present" ] }, - "id 36, removed", + "id 4, present", { - "_": "id 37, removed", + "_": "id 5, removed", "abuse": [ - "id 33, removed", - "id 34, removed" + "id 5, removed", + "id 6, removed" ], "message": [ - "id 33, removed", - "id 34, removed" + "id 5, removed", + "id 6, removed" ], "job": [ { - "_": "id 176, removed", + "_": "id 17, removed", "queueable_job": [ - "id 61, removed", - "id 62, removed" + "id 5, removed", + "id 6, removed" ], "job_version": [ - "id 61, removed", - "id 62, removed" + "id 5, removed", + "id 6, removed" ] }, - "id 177, removed" + "id 18, removed" ], "build": [ - { - "_": "id 173, removed", - "job": [ - "id 174, removed" - ], - "repository": [ - "id 71, present", - "id 70, present" - ], - "tag": [ - "id 41, present" - ], - "branch": [ - "id 41, present" - ], - "stage": [ - "id 37, removed" - ] - }, - "id 175, removed" + "id 14, removed, duplicate", + "id 16, removed, duplicate" ], "request_payload": [ - "id 33, removed", - "id 34, removed" + "id 5, removed", + "id 6, removed" ], "request_raw_configuration": [ - "id 35, removed", - "id 36, removed" + "id 5, removed", + "id 6, removed" ], "deleted_job": [ - "id 57, removed", - "id 58, removed" + "id 5, removed", + "id 6, removed" ], "deleted_build": [ - "id 63, removed", - "id 64, removed" + "id 7, removed", + "id 8, removed" ], "deleted_request_payload": [ - "id 33, removed", - "id 34, removed" + "id 5, removed", + "id 6, removed" ], "deleted_request_raw_configuration": [ - "id 35, removed", - "id 36, removed" - ] - }, - "id 38, removed", - "id 39, removed", - "id 40, present" - ], - "job": [ - { - "_": "id 57, present", - "queueable_job": [ - "id 19, present", - "id 20, present" - ], - "job_version": [ - "id 19, present", - "id 20, present" + "id 5, removed", + "id 6, removed" ] }, - "id 58, present", + "id 6, removed", { - "_": "id 171, present", - "queueable_job": [ - "id 59, present", - "id 60, present" - ], - "job_version": [ - "id 59, present", - "id 60, present" - ] - }, - "id 172, present" - ], - "branch": [ - { - "_": "id 14, present", - "build": [ - { - "_": "id 59, present", - "job": [ - "id 60, present" - ], - "repository": [ - "id 25, present", - "id 24, present" - ], - "tag": [ - "id 14, present" - ], - "branch": [ - "id 15, present" - ], - "stage": [ - "id 13, present" - ] - }, - "id 61, present" - ], - "commit": [ - { - "_": "id 7, present", - "build": [ - { - "_": "id 64, present", - "job": [ - "id 65, present" - ], - "repository": [ - "id 27, present", - "id 26, present" - ], - "tag": [ - "id 15, present" - ], - "branch": [ - "id 16, present" - ], - "stage": [ - "id 14, present" - ] - }, - "id 66, present" - ], - "job": [ - { - "_": "id 67, present", - "queueable_job": [ - "id 23, present", - "id 24, present" - ], - "job_version": [ - "id 23, present", - "id 24, present" - ] - }, - "id 68, present" - ], - "request": [ - { - "_": "id 13, present", - "abuse": [ - "id 11, present", - "id 12, present" - ], - "message": [ - "id 11, present", - "id 12, present" - ], - "job": [ - { - "_": "id 72, present", - "queueable_job": [ - "id 25, present", - "id 26, present" - ], - "job_version": [ - "id 25, present", - "id 26, present" - ] - }, - "id 73, present" - ], - "build": [ - { - "_": "id 69, present", - "job": [ - "id 70, present" - ], - "repository": [ - "id 29, present", - "id 28, present" - ], - "tag": [ - "id 16, present" - ], - "branch": [ - "id 17, present" - ], - "stage": [ - "id 15, present" - ] - }, - "id 71, present" - ], - "request_payload": [ - "id 11, present", - "id 12, present" - ], - "request_raw_configuration": [ - "id 11, present", - "id 12, present" - ], - "deleted_job": [ - "id 20, present", - "id 21, present" - ], - "deleted_build": [ - "id 21, present", - "id 22, present" - ], - "deleted_request_payload": [ - "id 11, present", - "id 12, present" - ], - "deleted_request_raw_configuration": [ - "id 11, present", - "id 12, present" - ] - }, - "id 14, present" - ], - "deleted_build": [ - "id 23, present", - "id 24, present" - ], - "deleted_job": [ - "id 22, present", - "id 23, present" - ], - "deleted_request": [ - "id 9, present", - "id 10, present" - ] - }, - "id 8, present" + "_": "id 7, removed", + "abuse": [ + "id 7, removed", + "id 8, removed" ], - "cron": [ - "id 2, present" + "message": [ + "id 7, removed", + "id 8, removed" ], "job": [ { - "_": "id 62, present", + "_": "id 24, removed", "queueable_job": [ - "id 21, present", - "id 22, present" + "id 9, removed", + "id 10, removed" ], "job_version": [ - "id 21, present", - "id 22, present" + "id 9, removed", + "id 10, removed" ] }, - "id 63, present" + "id 25, removed" ], - "request": [ - { - "_": "id 15, present", - "abuse": [ - "id 13, present", - "id 14, present" - ], - "message": [ - "id 13, present", - "id 14, present" - ], - "job": [ - { - "_": "id 77, present", - "queueable_job": [ - "id 27, present", - "id 28, present" - ], - "job_version": [ - "id 27, present", - "id 28, present" - ] - }, - "id 78, present" - ], - "build": [ - { - "_": "id 74, present", - "job": [ - "id 75, present" - ], - "repository": [ - "id 31, present", - "id 30, present" - ], - "tag": [ - "id 17, present" - ], - "branch": [ - "id 18, present" - ], - "stage": [ - "id 16, present" - ] - }, - "id 76, present" - ], - "request_payload": [ - "id 13, present", - "id 14, present" - ], - "request_raw_configuration": [ - "id 13, present", - "id 14, present" - ], - "deleted_job": [ - "id 24, present", - "id 25, present" - ], - "deleted_build": [ - "id 25, present", - "id 26, present" - ], - "deleted_request_payload": [ - "id 13, present", - "id 14, present" - ], - "deleted_request_raw_configuration": [ - "id 13, present", - "id 14, present" - ] - }, - "id 16, present" - ], - "deleted_build": [ - "id 19, present", - "id 20, present" - ], - "deleted_commit": [ - "id 5, present", - "id 6, present" - ], - "deleted_job": [ - "id 18, present", - "id 19, present" - ], - "deleted_request": [ - "id 11, present", - "id 12, present" - ] - }, - "id 19, present" - ], - "ssl_key": [ - "id 3, present", - "id 4, present" - ], - "commit": [ - { - "_": "id 9, present", "build": [ - { - "_": "id 79, present", - "job": [ - "id 80, present" - ], - "repository": [ - "id 33, present", - "id 32, present" - ], - "tag": [ - "id 18, present" - ], - "branch": [ - "id 20, present" - ], - "stage": [ - "id 17, present" - ] - }, - "id 81, present" + "id 21, removed, duplicate", + "id 23, removed, duplicate" ], - "job": [ - { - "_": "id 82, present", - "queueable_job": [ - "id 29, present", - "id 30, present" - ], - "job_version": [ - "id 29, present", - "id 30, present" - ] - }, - "id 83, present" - ], - "request": [ - { - "_": "id 17, present", - "abuse": [ - "id 15, present", - "id 16, present" - ], - "message": [ - "id 15, present", - "id 16, present" - ], - "job": [ - { - "_": "id 87, present", - "queueable_job": [ - "id 31, present", - "id 32, present" - ], - "job_version": [ - "id 31, present", - "id 32, present" - ] - }, - "id 88, present" - ], - "build": [ - { - "_": "id 84, present", - "job": [ - "id 85, present" - ], - "repository": [ - "id 35, present", - "id 34, present" - ], - "tag": [ - "id 19, present" - ], - "branch": [ - "id 21, present" - ], - "stage": [ - "id 18, present" - ] - }, - "id 86, present" - ], - "request_payload": [ - "id 15, present", - "id 16, present" - ], - "request_raw_configuration": [ - "id 15, present", - "id 16, present" - ], - "deleted_job": [ - "id 26, present", - "id 27, present" - ], - "deleted_build": [ - "id 27, present", - "id 28, present" - ], - "deleted_request_payload": [ - "id 15, present", - "id 16, present" - ], - "deleted_request_raw_configuration": [ - "id 15, present", - "id 16, present" - ] - }, - "id 18, present" + "request_payload": [ + "id 7, removed", + "id 8, removed" ], - "deleted_build": [ - "id 29, present", - "id 30, present" + "request_raw_configuration": [ + "id 7, removed", + "id 8, removed" ], "deleted_job": [ - "id 28, present", - "id 29, present" - ], - "deleted_request": [ - "id 13, present", - "id 14, present" - ] - }, - "id 10, present" - ], - "permission": [ - "id 3, present", - "id 4, present" - ], - "star": [ - "id 3, present", - "id 4, present" - ], - "pull_request": [ - { - "_": "id 3, present", - "request": [ - { - "_": "id 29, present", - "abuse": [ - "id 25, present", - "id 26, present" - ], - "message": [ - "id 25, present", - "id 26, present" - ], - "job": [ - { - "_": "id 143, present", - "queueable_job": [ - "id 49, present", - "id 50, present" - ], - "job_version": [ - "id 49, present", - "id 50, present" - ] - }, - "id 144, present" - ], - "build": [ - { - "_": "id 140, present", - "job": [ - "id 141, present" - ], - "repository": [ - "id 57, present", - "id 56, present" - ], - "tag": [ - "id 32, present" - ], - "branch": [ - "id 34, present" - ], - "stage": [ - "id 30, present" - ] - }, - "id 142, present" - ], - "request_payload": [ - "id 25, present", - "id 26, present" - ], - "request_raw_configuration": [ - "id 25, present", - "id 26, present" - ], - "deleted_job": [ - "id 45, present", - "id 46, present" - ], - "deleted_build": [ - "id 47, present", - "id 48, present" - ], - "deleted_request_payload": [ - "id 25, present", - "id 26, present" - ], - "deleted_request_raw_configuration": [ - "id 25, present", - "id 26, present" - ] - }, - "id 30, present" + "id 9, removed", + "id 10, removed" ], - "build": [ - { - "_": "id 89, present", - "job": [ - { - "_": "id 94, present", - "queueable_job": [ - "id 33, present", - "id 34, present" - ], - "job_version": [ - "id 33, present", - "id 34, present" - ] - }, - "id 95, present", - "id 96, present" - ], - "repository": [ - { - "_": "id 54, present", - "build": [ - "id 137, present" - ], - "request": [ - "id 28, present" - ], - "job": [ - "id 138, present" - ], - "branch": [ - "id 33, present" - ], - "ssl_key": [ - "id 6, present" - ], - "commit": [ - "id 16, present" - ], - "permission": [ - "id 6, present" - ], - "star": [ - "id 6, present" - ], - "pull_request": [ - "id 5, present" - ], - "tag": [ - "id 31, present" - ] - }, - "id 55, present", - { - "_": "id 52, present", - "build": [ - "id 135, present" - ], - "request": [ - "id 27, present" - ], - "job": [ - "id 136, present" - ], - "branch": [ - "id 32, present" - ], - "ssl_key": [ - "id 5, present" - ], - "commit": [ - "id 15, present" - ], - "permission": [ - "id 5, present" - ], - "star": [ - "id 5, present" - ], - "pull_request": [ - "id 4, present" - ], - "tag": [ - "id 30, present" - ] - }, - "id 53, present" - ], - "tag": [ - { - "_": "id 20, present", - "build": [ - { - "_": "id 97, present", - "job": [ - "id 98, present" - ], - "repository": [ - "id 37, present", - "id 36, present" - ], - "tag": [ - "id 21, present" - ], - "branch": [ - "id 22, present" - ], - "stage": [ - "id 22, present" - ] - }, - "id 99, present" - ], - "commit": [ - { - "_": "id 11, present", - "build": [ - { - "_": "id 100, present", - "job": [ - "id 101, present" - ], - "repository": [ - "id 39, present", - "id 38, present" - ], - "tag": [ - "id 22, present" - ], - "branch": [ - "id 23, present" - ], - "stage": [ - "id 23, present" - ] - }, - "id 102, present" - ], - "job": [ - { - "_": "id 103, present", - "queueable_job": [ - "id 35, present", - "id 36, present" - ], - "job_version": [ - "id 35, present", - "id 36, present" - ] - }, - "id 104, present" - ], - "request": [ - { - "_": "id 19, present", - "abuse": [ - "id 17, present", - "id 18, present" - ], - "message": [ - "id 17, present", - "id 18, present" - ], - "job": [ - { - "_": "id 108, present", - "queueable_job": [ - "id 37, present", - "id 38, present" - ], - "job_version": [ - "id 37, present", - "id 38, present" - ] - }, - "id 109, present" - ], - "build": [ - { - "_": "id 105, present", - "job": [ - "id 106, present" - ], - "repository": [ - "id 41, present", - "id 40, present" - ], - "tag": [ - "id 23, present" - ], - "branch": [ - "id 24, present" - ], - "stage": [ - "id 24, present" - ] - }, - "id 107, present" - ], - "request_payload": [ - "id 17, present", - "id 18, present" - ], - "request_raw_configuration": [ - "id 17, present", - "id 18, present" - ], - "deleted_job": [ - "id 30, present", - "id 31, present" - ], - "deleted_build": [ - "id 31, present", - "id 32, present" - ], - "deleted_request_payload": [ - "id 17, present", - "id 18, present" - ], - "deleted_request_raw_configuration": [ - "id 17, present", - "id 18, present" - ] - }, - "id 20, present" - ], - "deleted_build": [ - "id 33, present", - "id 34, present" - ], - "deleted_job": [ - "id 32, present", - "id 33, present" - ], - "deleted_request": [ - "id 15, present", - "id 16, present" - ] - }, - "id 12, present" - ], - "request": [ - { - "_": "id 21, present", - "abuse": [ - "id 19, present", - "id 20, present" - ], - "message": [ - "id 19, present", - "id 20, present" - ], - "job": [ - { - "_": "id 113, present", - "queueable_job": [ - "id 39, present", - "id 40, present" - ], - "job_version": [ - "id 39, present", - "id 40, present" - ] - }, - "id 114, present" - ], - "build": [ - { - "_": "id 110, present", - "job": [ - "id 111, present" - ], - "repository": [ - "id 43, present", - "id 42, present" - ], - "tag": [ - "id 24, present" - ], - "branch": [ - "id 25, present" - ], - "stage": [ - "id 25, present" - ] - }, - "id 112, present" - ], - "request_payload": [ - "id 19, present", - "id 20, present" - ], - "request_raw_configuration": [ - "id 19, present", - "id 20, present" - ], - "deleted_job": [ - "id 34, present", - "id 35, present" - ], - "deleted_build": [ - "id 35, present", - "id 36, present" - ], - "deleted_request_payload": [ - "id 19, present", - "id 20, present" - ], - "deleted_request_raw_configuration": [ - "id 19, present", - "id 20, present" - ] - }, - "id 22, present" - ], - "deleted_build": [ - "id 37, present", - "id 38, present" - ], - "deleted_commit": [ - "id 7, present", - "id 8, present" - ], - "deleted_request": [ - "id 17, present", - "id 18, present" - ] - }, - "id 25, present" - ], - "branch": [ - { - "_": "id 26, present", - "build": [ - { - "_": "id 115, present", - "job": [ - "id 116, present" - ], - "repository": [ - "id 45, present", - "id 44, present" - ], - "tag": [ - "id 26, present" - ], - "branch": [ - "id 27, present" - ], - "stage": [ - "id 26, present" - ] - }, - "id 117, present" - ], - "commit": [ - { - "_": "id 13, present", - "build": [ - { - "_": "id 120, present", - "job": [ - "id 121, present" - ], - "repository": [ - "id 47, present", - "id 46, present" - ], - "tag": [ - "id 27, present" - ], - "branch": [ - "id 28, present" - ], - "stage": [ - "id 27, present" - ] - }, - "id 122, present" - ], - "job": [ - { - "_": "id 123, present", - "queueable_job": [ - "id 43, present", - "id 44, present" - ], - "job_version": [ - "id 43, present", - "id 44, present" - ] - }, - "id 124, present" - ], - "request": [ - { - "_": "id 23, present", - "abuse": [ - "id 21, present", - "id 22, present" - ], - "message": [ - "id 21, present", - "id 22, present" - ], - "job": [ - { - "_": "id 128, present", - "queueable_job": [ - "id 45, present", - "id 46, present" - ], - "job_version": [ - "id 45, present", - "id 46, present" - ] - }, - "id 129, present" - ], - "build": [ - { - "_": "id 125, present", - "job": [ - "id 126, present" - ], - "repository": [ - "id 49, present", - "id 48, present" - ], - "tag": [ - "id 28, present" - ], - "branch": [ - "id 29, present" - ], - "stage": [ - "id 28, present" - ] - }, - "id 127, present" - ], - "request_payload": [ - "id 21, present", - "id 22, present" - ], - "request_raw_configuration": [ - "id 21, present", - "id 22, present" - ], - "deleted_job": [ - "id 38, present", - "id 39, present" - ], - "deleted_build": [ - "id 41, present", - "id 42, present" - ], - "deleted_request_payload": [ - "id 21, present", - "id 22, present" - ], - "deleted_request_raw_configuration": [ - "id 21, present", - "id 22, present" - ] - }, - "id 24, present" - ], - "deleted_build": [ - "id 43, present", - "id 44, present" - ], - "deleted_job": [ - "id 40, present", - "id 41, present" - ], - "deleted_request": [ - "id 19, present", - "id 20, present" - ] - }, - "id 14, present" - ], - "cron": [ - "id 3, present" - ], - "job": [ - { - "_": "id 118, present", - "queueable_job": [ - "id 41, present", - "id 42, present" - ], - "job_version": [ - "id 41, present", - "id 42, present" - ] - }, - "id 119, present" - ], - "request": [ - { - "_": "id 25, present", - "abuse": [ - "id 23, present", - "id 24, present" - ], - "message": [ - "id 23, present", - "id 24, present" - ], - "job": [ - { - "_": "id 133, present", - "queueable_job": [ - "id 47, present", - "id 48, present" - ], - "job_version": [ - "id 47, present", - "id 48, present" - ] - }, - "id 134, present" - ], - "build": [ - { - "_": "id 130, present", - "job": [ - "id 131, present" - ], - "repository": [ - "id 51, present", - "id 50, present" - ], - "tag": [ - "id 29, present" - ], - "branch": [ - "id 30, present" - ], - "stage": [ - "id 29, present" - ] - }, - "id 132, present" - ], - "request_payload": [ - "id 23, present", - "id 24, present" - ], - "request_raw_configuration": [ - "id 23, present", - "id 24, present" - ], - "deleted_job": [ - "id 42, present", - "id 43, present" - ], - "deleted_build": [ - "id 45, present", - "id 46, present" - ], - "deleted_request_payload": [ - "id 23, present", - "id 24, present" - ], - "deleted_request_raw_configuration": [ - "id 23, present", - "id 24, present" - ] - }, - "id 26, present" - ], - "deleted_build": [ - "id 39, present", - "id 40, present" - ], - "deleted_commit": [ - "id 9, present", - "id 10, present" - ], - "deleted_job": [ - "id 36, present", - "id 37, present" - ], - "deleted_request": [ - "id 21, present", - "id 22, present" - ] - }, - "id 31, present" - ], - "stage": [ - { - "_": "id 19, present", - "job": [ - "id 90, present", - "id 91, present" - ] - }, - { - "_": "id 20, present", - "job": [ - "id 92, present", - "id 93, present" - ] - }, - "id 21, present" - ], - "deleted_job": [ - "id 44, present" - ], - "deleted_tag": [ - "id 2, present" - ], - "deleted_stage": [ - "id 2, present" - ] - }, - "id 139, present" + "deleted_build": [ + "id 9, removed", + "id 10, removed" ], - "deleted_request": [ - "id 23, present", - "id 24, present" + "deleted_request_payload": [ + "id 7, removed", + "id 8, removed" ], - "deleted_build": [ - "id 49, present", - "id 50, present" + "deleted_request_raw_configuration": [ + "id 7, removed", + "id 8, removed" ] }, - "id 6, present" + "id 8, removed" ], - "tag": [ + "job": [ { - "_": "id 33, present", - "build": [ - { - "_": "id 145, present", - "job": [ - "id 146, present" - ], - "repository": [ - "id 59, present", - "id 58, present" - ], - "tag": [ - "id 34, present" - ], - "branch": [ - "id 35, present" - ], - "stage": [ - "id 31, present" - ] - }, - "id 147, present" - ], - "commit": [ - { - "_": "id 17, present", - "build": [ - { - "_": "id 148, present", - "job": [ - "id 149, present" - ], - "repository": [ - "id 61, present", - "id 60, present" - ], - "tag": [ - "id 35, present" - ], - "branch": [ - "id 36, present" - ], - "stage": [ - "id 32, present" - ] - }, - "id 150, present" - ], - "job": [ - { - "_": "id 151, present", - "queueable_job": [ - "id 51, present", - "id 52, present" - ], - "job_version": [ - "id 51, present", - "id 52, present" - ] - }, - "id 152, present" - ], - "request": [ - { - "_": "id 31, present", - "abuse": [ - "id 27, present", - "id 28, present" - ], - "message": [ - "id 27, present", - "id 28, present" - ], - "job": [ - { - "_": "id 156, present", - "queueable_job": [ - "id 53, present", - "id 54, present" - ], - "job_version": [ - "id 53, present", - "id 54, present" - ] - }, - "id 157, present" - ], - "build": [ - { - "_": "id 153, present", - "job": [ - "id 154, present" - ], - "repository": [ - "id 63, present", - "id 62, present" - ], - "tag": [ - "id 36, present" - ], - "branch": [ - "id 37, present" - ], - "stage": [ - "id 33, present" - ] - }, - "id 155, present" - ], - "request_payload": [ - "id 27, present", - "id 28, present" - ], - "request_raw_configuration": [ - "id 27, present", - "id 28, present" - ], - "deleted_job": [ - "id 47, present", - "id 48, present" - ], - "deleted_build": [ - "id 51, present", - "id 52, present" - ], - "deleted_request_payload": [ - "id 27, present", - "id 28, present" - ], - "deleted_request_raw_configuration": [ - "id 27, present", - "id 28, present" - ] - }, - "id 32, present" - ], - "deleted_build": [ - "id 53, present", - "id 54, present" - ], - "deleted_job": [ - "id 49, present", - "id 50, present" - ], - "deleted_request": [ - "id 25, present", - "id 26, present" - ] - }, - "id 18, present" - ], - "request": [ - { - "_": "id 33, present", - "abuse": [ - "id 29, present", - "id 30, present" - ], - "message": [ - "id 29, present", - "id 30, present" - ], - "job": [ - { - "_": "id 161, present", - "queueable_job": [ - "id 55, present", - "id 56, present" - ], - "job_version": [ - "id 55, present", - "id 56, present" - ] - }, - "id 162, present" - ], - "build": [ - { - "_": "id 158, present", - "job": [ - "id 159, present" - ], - "repository": [ - "id 65, present", - "id 64, present" - ], - "tag": [ - "id 37, present" - ], - "branch": [ - "id 38, present" - ], - "stage": [ - "id 34, present" - ] - }, - "id 160, present" - ], - "request_payload": [ - "id 29, present", - "id 30, present" - ], - "request_raw_configuration": [ - "id 29, present", - "id 30, present" - ], - "deleted_job": [ - "id 51, present", - "id 52, present" - ], - "deleted_build": [ - "id 55, present", - "id 56, present" - ], - "deleted_request_payload": [ - "id 29, present", - "id 30, present" - ], - "deleted_request_raw_configuration": [ - "id 29, present", - "id 30, present" - ] - }, - "id 34, present" - ], - "deleted_build": [ - "id 57, present", - "id 58, present" - ], - "deleted_commit": [ - "id 11, present", - "id 12, present" + "_": "id 19, present", + "queueable_job": [ + "id 7, present", + "id 8, present" ], - "deleted_request": [ - "id 27, present", - "id 28, present" + "job_version": [ + "id 7, present", + "id 8, present" ] }, - "id 38, present" + "id 20, present" ], "build_config": [ { "_": "id 1, present", "build": [ - "id 163, present, duplicate", - "id 165, present, duplicate" + "id 11, present, duplicate", + "id 13, present, duplicate" ], "deleted_build": [ - "id 59, present", - "id 60, present" + "id 5, present", + "id 6, present" ] }, "id 2, removed" ], - "email_unsubscribe": [ - "id 1, present", - "id 2, present" - ], "request_config": [ { "_": "id 1, removed", "request": [ - "id 35, removed, duplicate", - "id 36, removed, duplicate" + "id 5, removed, duplicate", + "id 6, removed, duplicate" ], "deleted_request": [ - "id 29, present", - "id 30, present" + "id 1, present", + "id 2, present" ] }, "id 2, removed" @@ -2383,12 +368,12 @@ def self.remove_repo_requests { "_": "id 1, present", "job": [ - "id 171, present, duplicate", - "id 172, present, duplicate" + "id 19, present, duplicate", + "id 20, present, duplicate" ], "deleted_job": [ - "id 55, present", - "id 56, present" + "id 7, present", + "id 8, present" ] }, "id 2, removed" @@ -2397,81 +382,29 @@ def self.remove_repo_requests { "_": "id 1, present", "request_raw_configuration": [ - "id 33, present", - "id 34, present" + "id 9, present", + "id 10, present" ], "deleted_request_raw_configuration": [ - "id 33, present", - "id 34, present" + "id 9, present", + "id 10, present" ] }, "id 2, removed" ], - "repo_count": [ - "id 1, present", - "id 1, present, duplicate" - ], "request_yaml_config": [ { "_": "id 1, removed", "request": [ - "id 37, removed, duplicate", - "id 38, removed, duplicate" + "id 7, removed, duplicate", + "id 8, removed, duplicate" ], "deleted_request": [ - "id 31, present", - "id 32, present" + "id 3, present", + "id 4, present" ] }, "id 2, removed" - ], - "deleted_build": [ - "id 65, present", - "id 66, present" - ], - "deleted_request": [ - "id 33, present", - "id 34, present" - ], - "deleted_job": [ - "id 59, present", - "id 60, present" - ], - "deleted_ssl_key": [ - "id 1, present", - "id 2, present" - ], - "deleted_commit": [ - "id 13, present", - "id 14, present" - ], - "deleted_pull_request": [ - "id 1, present", - "id 2, present" - ], - "deleted_tag": [ - "id 3, present", - "id 4, present" - ], - "deleted_build_config": [ - "id 1, present", - "id 2, present" - ], - "deleted_request_config": [ - "id 1, present", - "id 2, present" - ], - "deleted_job_config": [ - "id 1, present", - "id 2, present" - ], - "deleted_request_raw_config": [ - "id 1, present", - "id 2, present" - ], - "deleted_request_yaml_config": [ - "id 1, present", - "id 2, present" ] } end diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index 4b92677..a8378a7 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -122,57 +122,70 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) create(:repository, repository.attributes_without_id.symbolize_keys) end end + end - factory :repository_for_removing_heavy_data do - created_at { 12.months.ago.to_time.utc } - updated_at { 12.months.ago.to_time.utc } + factory :repository_for_removing_heavy_data do + created_at { 12.months.ago.to_time.utc } + updated_at { 12.months.ago.to_time.utc } - after(:create) do |repository| - create_for_repo(repository, :build_for_removing_heavy_data) - create_for_repo_without_timestamps(repository, :build_for_removing_heavy_data) - last_build = create_for_repo(repository, :build_for_removing_heavy_data).last - create_for_repo(repository, :request) - create_for_repo_without_timestamps(repository, :request) - - Repository.record_timestamps = false - Request.record_timestamps = false - repository.update(last_build_id: last_build.id) - - repository.request_configs.each do |config| - config.requests.each do |request| - request.update(repository_id: repository.id) - end + after(:create) do |repository| + # create_for_repo(repository, :build_for_removing_heavy_data) + # create_for_repo_without_timestamps(repository, :build_for_removing_heavy_data) + # last_build = create_for_repo(repository, :build_for_removing_heavy_data).last + create_for_repo(repository, :request_with_all_dependencies_and_sibling) + create_for_repo_without_timestamps(repository, :request_with_all_dependencies_and_sibling) + + create_for_repo(repository, :build_config_with_all_dependencies_and_sibling) + create_for_repo(repository, :request_config_with_all_dependencies_and_sibling) + create_for_repo(repository, :job_config_with_all_dependencies_and_sibling) + create_for_repo(repository, :request_yaml_config_with_all_dependencies_and_sibling) + create_for_repo_without_timestamps(repository, :request_raw_config_with_all_dependencies_and_sibling) + + Repository.record_timestamps = false + Request.record_timestamps = false + + # repository.update(last_build_id: repository.id) + + repository.request_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) end + end - # repository.request_raw_configs.each do |config| - # config.request_raw_configurations.each do |configuration| - # configuration.requests.each do |request| - # request.update(repository_id: repository.id) - # end - # end - # end - - repository.request_yaml_configs.each do |config| - config.requests.each do |request| - request.update(repository_id: repository.id) - end + # repository.request_raw_configs.each do |config| + # config.request_raw_configurations.each do |configuration| + # configuration.requests.each do |request| + # request.update(repository_id: repository.id) + # end + # end + # end + + repository.request_yaml_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) end + end - repository.build_configs.each do |config| - config.builds.each do |build| - build.update(repository_id: repository.id) - end + repository.build_configs.each do |config| + config.builds.each do |build| + build.update(repository_id: repository.id) end + end - repository.job_configs.each do |config| - config.jobs.each do |job| - job.update(repository_id: repository.id) - end + repository.job_configs.each do |config| + config.jobs.each do |job| + job.update(repository_id: repository.id) end + end - Repository.record_timestamps = true - Request.record_timestamps = true + repository.requests.each do |request| + request.builds.each do |build| + build.update(repository_id: repository.id) + end end + + Repository.record_timestamps = true + Request.record_timestamps = true end end From 9b8b6e856efe0bde6d5390b8cdcbacff1b1280f8 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Fri, 29 Apr 2022 04:59:46 +0200 Subject: [PATCH 10/11] removing only newly orphaned configs --- .../remove_specified/remove_heavy_data.rb | 108 +++++----- spec/backup/remove_specified_spec.rb | 2 +- .../remove_repo_requests.rb | 10 +- .../remove_repo_builds/build_1-192.json | 185 ------------------ .../remove_repo_builds/deleted_job_15-15.json | 39 ---- .../remove_repo_builds/deleted_stage_1-1.json | 16 -- .../remove_repo_builds/job_182-194.json | 175 ----------------- .../remove_repo_builds/job_195-198.json | 141 ------------- .../remove_repo_builds/job_2-6.json | 175 ----------------- .../remove_repo_builds/job_7-181.json | 175 ----------------- .../nullified_relationships/build_1.json | 3 - .../nullified_relationships/build_2.json | 3 - .../remove_repo_builds/stage_1-39.json | 60 ------ .../remove_repo_builds/stage_42-43.json | 27 --- .../remove_repo_requests/abuse_1-7.json | 55 ++++++ .../remove_repo_requests/abuse_34-34.json | 15 -- .../remove_repo_requests/abuse_8-8.json | 15 ++ .../remove_repo_requests/abuse_9-33.json | 55 ------ .../{build_52-173.json => build_1-21.json} | 50 ++--- .../{build_175-175.json => build_23-23.json} | 10 +- ...uild_17-63.json => deleted_build_1-9.json} | 40 ++-- ...ld_64-64.json => deleted_build_10-10.json} | 8 +- ...ed_job_16-57.json => deleted_job_1-9.json} | 40 ++-- ..._job_58-58.json => deleted_job_10-10.json} | 8 +- ....json => deleted_request_payload_1-7.json} | 30 +-- ....json => deleted_request_payload_8-8.json} | 6 +- ...eleted_request_raw_configuration_1-7.json} | 20 +- ...eleted_request_raw_configuration_8-8.json} | 4 +- .../{job_170-177.json => job_18-25.json} | 32 +-- .../{job_53-169.json => job_2-17.json} | 40 ++-- .../remove_repo_requests/job_config_2-2.json | 13 -- .../job_version_1-9.json} | 26 +-- .../job_version_10-10.json} | 6 +- .../job_version_17-61.json | 65 ------ .../job_version_62-62.json | 17 -- .../{message_9-33.json => message_1-7.json} | 40 ++-- .../{message_34-34.json => message_8-8.json} | 8 +- .../queueable_job_1-9.json} | 16 +- .../queueable_job_10-10.json} | 4 +- .../queueable_job_17-61.json | 25 --- .../queueable_job_62-62.json | 9 - .../{request_11-37.json => request_1-7.json} | 30 +-- .../remove_repo_requests/request_38-39.json | 69 ------- .../remove_repo_requests/request_8-8.json | 37 ++++ ...onfig_2-2.json => request_config_1-1.json} | 4 +- .../request_config_1-2.json | 21 -- ...oad_9-33.json => request_payload_1-7.json} | 30 +-- ...ad_34-34.json => request_payload_8-8.json} | 6 +- .../request_raw_config_2-2.json | 12 -- ...son => request_raw_configuration_1-7.json} | 20 +- ...son => request_raw_configuration_8-8.json} | 4 +- ..._1-2.json => request_yaml_config_1-1.json} | 8 - .../{stage_12-37.json => stage_1-5.json} | 12 +- 53 files changed, 422 insertions(+), 1607 deletions(-) delete mode 100644 spec/support/expected_files/remove_repo_builds/build_1-192.json delete mode 100644 spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json delete mode 100644 spec/support/expected_files/remove_repo_builds/deleted_stage_1-1.json delete mode 100644 spec/support/expected_files/remove_repo_builds/job_182-194.json delete mode 100644 spec/support/expected_files/remove_repo_builds/job_195-198.json delete mode 100644 spec/support/expected_files/remove_repo_builds/job_2-6.json delete mode 100644 spec/support/expected_files/remove_repo_builds/job_7-181.json delete mode 100644 spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json delete mode 100644 spec/support/expected_files/remove_repo_builds/nullified_relationships/build_2.json delete mode 100644 spec/support/expected_files/remove_repo_builds/stage_1-39.json delete mode 100644 spec/support/expected_files/remove_repo_builds/stage_42-43.json create mode 100644 spec/support/expected_files/remove_repo_requests/abuse_1-7.json delete mode 100644 spec/support/expected_files/remove_repo_requests/abuse_34-34.json create mode 100644 spec/support/expected_files/remove_repo_requests/abuse_8-8.json delete mode 100644 spec/support/expected_files/remove_repo_requests/abuse_9-33.json rename spec/support/expected_files/remove_repo_requests/{build_52-173.json => build_1-21.json} (86%) rename spec/support/expected_files/remove_repo_requests/{build_175-175.json => build_23-23.json} (86%) rename spec/support/expected_files/remove_repo_requests/{deleted_build_17-63.json => deleted_build_1-9.json} (88%) rename spec/support/expected_files/remove_repo_requests/{deleted_build_64-64.json => deleted_build_10-10.json} (88%) rename spec/support/expected_files/remove_repo_requests/{deleted_job_16-57.json => deleted_job_1-9.json} (84%) rename spec/support/expected_files/remove_repo_requests/{deleted_job_58-58.json => deleted_job_10-10.json} (84%) rename spec/support/expected_files/remove_repo_requests/{deleted_request_payload_9-33.json => deleted_request_payload_1-7.json} (53%) rename spec/support/expected_files/remove_repo_requests/{deleted_request_payload_34-34.json => deleted_request_payload_8-8.json} (62%) rename spec/support/expected_files/remove_repo_requests/{deleted_request_raw_configuration_9-35.json => deleted_request_raw_configuration_1-7.json} (80%) rename spec/support/expected_files/remove_repo_requests/{deleted_request_raw_configuration_36-36.json => deleted_request_raw_configuration_8-8.json} (82%) rename spec/support/expected_files/remove_repo_requests/{job_170-177.json => job_18-25.json} (84%) rename spec/support/expected_files/remove_repo_requests/{job_53-169.json => job_2-17.json} (84%) delete mode 100644 spec/support/expected_files/remove_repo_requests/job_config_2-2.json rename spec/support/expected_files/{remove_repo_builds/job_version_1-67.json => remove_repo_requests/job_version_1-9.json} (72%) rename spec/support/expected_files/{remove_repo_builds/job_version_68-68.json => remove_repo_requests/job_version_10-10.json} (73%) delete mode 100644 spec/support/expected_files/remove_repo_requests/job_version_17-61.json delete mode 100644 spec/support/expected_files/remove_repo_requests/job_version_62-62.json rename spec/support/expected_files/remove_repo_requests/{message_9-33.json => message_1-7.json} (60%) rename spec/support/expected_files/remove_repo_requests/{message_34-34.json => message_8-8.json} (63%) rename spec/support/expected_files/{remove_repo_builds/queueable_job_1-67.json => remove_repo_requests/queueable_job_1-9.json} (50%) rename spec/support/expected_files/{remove_repo_builds/queueable_job_68-68.json => remove_repo_requests/queueable_job_10-10.json} (64%) delete mode 100644 spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json delete mode 100644 spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json rename spec/support/expected_files/remove_repo_requests/{request_11-37.json => request_1-7.json} (87%) delete mode 100644 spec/support/expected_files/remove_repo_requests/request_38-39.json create mode 100644 spec/support/expected_files/remove_repo_requests/request_8-8.json rename spec/support/expected_files/remove_repo_requests/{build_config_2-2.json => request_config_1-1.json} (75%) delete mode 100644 spec/support/expected_files/remove_repo_requests/request_config_1-2.json rename spec/support/expected_files/remove_repo_requests/{request_payload_9-33.json => request_payload_1-7.json} (53%) rename spec/support/expected_files/remove_repo_requests/{request_payload_34-34.json => request_payload_8-8.json} (60%) delete mode 100644 spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json rename spec/support/expected_files/remove_repo_requests/{request_raw_configuration_9-35.json => request_raw_configuration_1-7.json} (80%) rename spec/support/expected_files/remove_repo_requests/{request_raw_configuration_36-36.json => request_raw_configuration_8-8.json} (82%) rename spec/support/expected_files/remove_repo_requests/{request_yaml_config_1-2.json => request_yaml_config_1-1.json} (58%) rename spec/support/expected_files/remove_repo_requests/{stage_12-37.json => stage_1-5.json} (82%) diff --git a/lib/backup/remove_specified/remove_heavy_data.rb b/lib/backup/remove_specified/remove_heavy_data.rb index 1200567..7b1666d 100644 --- a/lib/backup/remove_specified/remove_heavy_data.rb +++ b/lib/backup/remove_specified/remove_heavy_data.rb @@ -68,63 +68,79 @@ def remove_repo_requests(repository) private + def find_config_ids_orphaned_now(model1:, model2:, repository:, foreign_key:, ids_to_remove:) + ids_to_exclude = ids_to_remove[model2.table_name.singularize.to_sym].join(', ') + + orphaned_earlier = model1.find_by_sql(%{ + select a.id + from #{model1.table_name} as a + left join #{model2.table_name} as b on + a.id = b.#{foreign_key} + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + + + all_orphaned = model1.find_by_sql(%{ + select a.id + from #{model1.table_name} as a + left join #{model2.table_name} as b on + a.id = b.#{foreign_key} and b.id not in (#{ids_to_exclude}) + where a.repository_id = #{repository.id} + group by a.id + having count(b.id) = 0; + }).map { |x| x.id } + + all_orphaned - orphaned_earlier + end + def orphaned_configs_to_remove(repository, ids_to_remove) if ids_to_remove[:request] - request_config_ids = RequestConfig.find_by_sql(%{ - select a.id - from request_configs as a - left join requests as b on - a.id = b.config_id and b.id not in (#{ids_to_remove[:request].join(', ')}) - where a.repository_id = #{repository.id} - group by a.id - having count(b.id) = 0; - }).map { |x| x.id } - - request_yaml_config_ids = RequestYamlConfig.find_by_sql(%{ - select a.id - from request_yaml_configs as a - left join requests as b on - a.id = b.yaml_config_id and b.id not in (#{ids_to_remove[:request].join(', ')}) - where a.repository_id = #{repository.id} - group by a.id - having count(b.id) = 0; - }).map { |x| x.id } + request_config_ids = find_config_ids_orphaned_now( + model1: RequestConfig, + model2: Request, + repository: repository, + foreign_key: 'config_id', + ids_to_remove: ids_to_remove + ) + request_yaml_config_ids = find_config_ids_orphaned_now( + model1: RequestYamlConfig, + model2: Request, + repository: repository, + foreign_key: 'yaml_config_id', + ids_to_remove: ids_to_remove + ) end if ids_to_remove[:request_raw_configuration] - request_raw_config_ids = RequestRawConfig.find_by_sql(%{ - select a.id - from request_raw_configs as a - left join request_raw_configurations as b on - a.id = b.request_raw_config_id and b.id not in (#{ids_to_remove[:request_raw_configuration].join(', ')}) - where a.repository_id = #{repository.id} - group by a.id - having count(b.id) = 0; - }).map { |x| x.id } + request_raw_config_ids = find_config_ids_orphaned_now( + model1: RequestRawConfig, + model2: RequestRawConfiguration, + repository: repository, + foreign_key: 'request_raw_config_id', + ids_to_remove: ids_to_remove + ) end if ids_to_remove[:build] - build_config_ids = BuildConfig.find_by_sql(%{ - select a.id - from build_configs as a - left join builds as b on - a.id = b.config_id and b.id not in (#{ids_to_remove[:build].join(', ')}) - where a.repository_id = #{repository.id} - group by a.id - having count(b.id) = 0; - }).map { |x| x.id } + build_config_ids = find_config_ids_orphaned_now( + model1: BuildConfig, + model2: Build, + repository: repository, + foreign_key: 'config_id', + ids_to_remove: ids_to_remove + ) end if ids_to_remove[:job] - job_config_ids = JobConfig.find_by_sql(%{ - select a.id - from job_configs as a - left join jobs as b on - a.id = b.config_id and b.id not in (#{ids_to_remove[:job].join(', ')}) - where a.repository_id = #{repository.id} - group by a.id - having count(b.id) = 0; - }).map { |x| x.id } + job_config_ids = find_config_ids_orphaned_now( + model1: JobConfig, + model2: Job, + repository: repository, + foreign_key: 'config_id', + ids_to_remove: ids_to_remove + ) end orphaned_ids = IdHash.new diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index 3925417..d4f649a 100644 --- a/spec/backup/remove_specified_spec.rb +++ b/spec/backup/remove_specified_spec.rb @@ -162,7 +162,7 @@ db_helper.do_without_triggers do expect { remove_specified.remove_repo_requests(repository) - }.to change { Model.sum_of_subclasses_rows }.by(-92) + }.to change { Model.sum_of_subclasses_rows }.by(-86) end end diff --git a/spec/support/expected_dependency_trees/remove_repo_requests.rb b/spec/support/expected_dependency_trees/remove_repo_requests.rb index 97066ec..19e74ad 100644 --- a/spec/support/expected_dependency_trees/remove_repo_requests.rb +++ b/spec/support/expected_dependency_trees/remove_repo_requests.rb @@ -348,7 +348,7 @@ def self.remove_repo_requests "id 6, present" ] }, - "id 2, removed" + "id 2, present" ], "request_config": [ { @@ -362,7 +362,7 @@ def self.remove_repo_requests "id 2, present" ] }, - "id 2, removed" + "id 2, present" ], "job_config": [ { @@ -376,7 +376,7 @@ def self.remove_repo_requests "id 8, present" ] }, - "id 2, removed" + "id 2, present" ], "request_raw_config": [ { @@ -390,7 +390,7 @@ def self.remove_repo_requests "id 10, present" ] }, - "id 2, removed" + "id 2, present" ], "request_yaml_config": [ { @@ -404,7 +404,7 @@ def self.remove_repo_requests "id 4, present" ] }, - "id 2, removed" + "id 2, present" ] } end diff --git a/spec/support/expected_files/remove_repo_builds/build_1-192.json b/spec/support/expected_files/remove_repo_builds/build_1-192.json deleted file mode 100644 index b5a96d6..0000000 --- a/spec/support/expected_files/remove_repo_builds/build_1-192.json +++ /dev/null @@ -1,185 +0,0 @@ -{ - "table_name": "builds", - "data": [ - { - "id": 1, - "repository_id": 1, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": null, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - }, - { - "id": 51, - "repository_id": 1, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": null, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - }, - { - "id": 178, - "repository_id": 1, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": null, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - }, - { - "id": 192, - "repository_id": 1, - "number": null, - "started_at": null, - "finished_at": null, - "log": "", - "message": null, - "committed_at": null, - "committer_name": null, - "committer_email": null, - "author_name": null, - "author_email": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "ref": null, - "branch": null, - "github_payload": null, - "compare_url": null, - "token": null, - "commit_id": null, - "request_id": null, - "state": null, - "duration": null, - "owner_type": null, - "owner_id": null, - "event_type": null, - "previous_state": null, - "pull_request_title": null, - "pull_request_number": null, - "canceled_at": null, - "cached_matrix_ids": null, - "received_at": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "unique_number": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json b/spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json deleted file mode 100644 index 457ce18..0000000 --- a/spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "table_name": "deleted_jobs", - "data": [ - { - "id": 15, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 1, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": null, - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": null, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/deleted_stage_1-1.json b/spec/support/expected_files/remove_repo_builds/deleted_stage_1-1.json deleted file mode 100644 index d5f8047..0000000 --- a/spec/support/expected_files/remove_repo_builds/deleted_stage_1-1.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "table_name": "deleted_stages", - "data": [ - { - "id": 1, - "build_id": 1, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/job_182-194.json b/spec/support/expected_files/remove_repo_builds/job_182-194.json deleted file mode 100644 index fedbde4..0000000 --- a/spec/support/expected_files/remove_repo_builds/job_182-194.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "table_name": "jobs", - "data": [ - { - "id": 182, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 39, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 183, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 178, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 184, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 178, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 193, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 42, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 194, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 42, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/job_195-198.json b/spec/support/expected_files/remove_repo_builds/job_195-198.json deleted file mode 100644 index 265f8aa..0000000 --- a/spec/support/expected_files/remove_repo_builds/job_195-198.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "table_name": "jobs", - "data": [ - { - "id": 195, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 43, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 196, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 43, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 197, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 192, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 198, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 192, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/job_2-6.json b/spec/support/expected_files/remove_repo_builds/job_2-6.json deleted file mode 100644 index 431fc30..0000000 --- a/spec/support/expected_files/remove_repo_builds/job_2-6.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "table_name": "jobs", - "data": [ - { - "id": 2, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 1, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 3, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 1, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 4, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 2, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 5, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 2, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 6, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 1, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/job_7-181.json b/spec/support/expected_files/remove_repo_builds/job_7-181.json deleted file mode 100644 index f488582..0000000 --- a/spec/support/expected_files/remove_repo_builds/job_7-181.json +++ /dev/null @@ -1,175 +0,0 @@ -{ - "table_name": "jobs", - "data": [ - { - "id": 7, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 1, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 8, - "repository_id": null, - "commit_id": null, - "source_type": "Build", - "source_id": 1, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 179, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 38, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 180, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 38, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - }, - { - "id": 181, - "repository_id": null, - "commit_id": null, - "source_type": null, - "source_id": null, - "queue": null, - "type": null, - "state": null, - "number": null, - "log": "", - "worker": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-08-23 20:23:56 UTC", - "updated_at": "2021-08-23 20:23:56 UTC", - "tags": null, - "allow_failure": false, - "owner_type": null, - "owner_id": null, - "result": null, - "queued_at": null, - "canceled_at": null, - "received_at": null, - "debug_options": null, - "private": null, - "stage_number": null, - "stage_id": 39, - "org_id": null, - "com_id": null, - "config_id": null, - "restarted_at": null, - "priority": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json b/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json deleted file mode 100644 index 83fb8fc..0000000 --- a/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "table_name": "builds" -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_2.json b/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_2.json deleted file mode 100644 index 83fb8fc..0000000 --- a/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "table_name": "builds" -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/stage_1-39.json b/spec/support/expected_files/remove_repo_builds/stage_1-39.json deleted file mode 100644 index ff8f7ae..0000000 --- a/spec/support/expected_files/remove_repo_builds/stage_1-39.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "table_name": "stages", - "data": [ - { - "id": 1, - "build_id": 1, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - }, - { - "id": 2, - "build_id": 1, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - }, - { - "id": 3, - "build_id": 1, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - }, - { - "id": 38, - "build_id": 178, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - }, - { - "id": 39, - "build_id": 178, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/stage_42-43.json b/spec/support/expected_files/remove_repo_builds/stage_42-43.json deleted file mode 100644 index d68d03c..0000000 --- a/spec/support/expected_files/remove_repo_builds/stage_42-43.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "table_name": "stages", - "data": [ - { - "id": 42, - "build_id": 192, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - }, - { - "id": 43, - "build_id": 192, - "number": null, - "name": null, - "state": null, - "started_at": null, - "finished_at": null, - "org_id": null, - "com_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_1-7.json b/spec/support/expected_files/remove_repo_requests/abuse_1-7.json new file mode 100644 index 0000000..a34efec --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/abuse_1-7.json @@ -0,0 +1,55 @@ +{ + "table_name": "abuses", + "data": [ + { + "id": 1, + "owner_type": null, + "owner_id": null, + "request_id": 1, + "level": 1, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + }, + { + "id": 2, + "owner_type": null, + "owner_id": null, + "request_id": 1, + "level": 2, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + }, + { + "id": 5, + "owner_type": null, + "owner_id": null, + "request_id": 5, + "level": 5, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + }, + { + "id": 6, + "owner_type": null, + "owner_id": null, + "request_id": 5, + "level": 6, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + }, + { + "id": 7, + "owner_type": null, + "owner_id": null, + "request_id": 7, + "level": 7, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_34-34.json b/spec/support/expected_files/remove_repo_requests/abuse_34-34.json deleted file mode 100644 index 8aeb3ba..0000000 --- a/spec/support/expected_files/remove_repo_requests/abuse_34-34.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "table_name": "abuses", - "data": [ - { - "id": 34, - "owner_type": null, - "owner_id": null, - "request_id": 37, - "level": 34, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_8-8.json b/spec/support/expected_files/remove_repo_requests/abuse_8-8.json new file mode 100644 index 0000000..4aca7e2 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/abuse_8-8.json @@ -0,0 +1,15 @@ +{ + "table_name": "abuses", + "data": [ + { + "id": 8, + "owner_type": null, + "owner_id": null, + "request_id": 7, + "level": 8, + "reason": "some text", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC" + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_9-33.json b/spec/support/expected_files/remove_repo_requests/abuse_9-33.json deleted file mode 100644 index c655330..0000000 --- a/spec/support/expected_files/remove_repo_requests/abuse_9-33.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "table_name": "abuses", - "data": [ - { - "id": 9, - "owner_type": null, - "owner_id": null, - "request_id": 11, - "level": 9, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - }, - { - "id": 10, - "owner_type": null, - "owner_id": null, - "request_id": 11, - "level": 10, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - }, - { - "id": 31, - "owner_type": null, - "owner_id": null, - "request_id": 35, - "level": 31, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - }, - { - "id": 32, - "owner_type": null, - "owner_id": null, - "request_id": 35, - "level": 32, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - }, - { - "id": 33, - "owner_type": null, - "owner_id": null, - "request_id": 37, - "level": 33, - "reason": "some text", - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC" - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_52-173.json b/spec/support/expected_files/remove_repo_requests/build_1-21.json similarity index 86% rename from spec/support/expected_files/remove_repo_requests/build_52-173.json rename to spec/support/expected_files/remove_repo_requests/build_1-21.json index 23dcb94..2a2a008 100644 --- a/spec/support/expected_files/remove_repo_requests/build_52-173.json +++ b/spec/support/expected_files/remove_repo_requests/build_1-21.json @@ -2,8 +2,8 @@ "table_name": "builds", "data": [ { - "id": 52, - "repository_id": null, + "id": 1, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -14,15 +14,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 11, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -47,8 +47,8 @@ "unique_number": null }, { - "id": 54, - "repository_id": null, + "id": 3, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -59,15 +59,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 11, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -92,8 +92,8 @@ "unique_number": null }, { - "id": 166, - "repository_id": null, + "id": 14, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -104,15 +104,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 35, + "request_id": 5, "state": null, "duration": null, "owner_type": null, @@ -137,8 +137,8 @@ "unique_number": null }, { - "id": 168, - "repository_id": null, + "id": 16, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -149,15 +149,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 35, + "request_id": 5, "state": null, "duration": null, "owner_type": null, @@ -182,8 +182,8 @@ "unique_number": null }, { - "id": 173, - "repository_id": null, + "id": 21, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -194,15 +194,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 37, + "request_id": 7, "state": null, "duration": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/build_175-175.json b/spec/support/expected_files/remove_repo_requests/build_23-23.json similarity index 86% rename from spec/support/expected_files/remove_repo_requests/build_175-175.json rename to spec/support/expected_files/remove_repo_requests/build_23-23.json index 2a24f6c..82c97ac 100644 --- a/spec/support/expected_files/remove_repo_requests/build_175-175.json +++ b/spec/support/expected_files/remove_repo_requests/build_23-23.json @@ -2,8 +2,8 @@ "table_name": "builds", "data": [ { - "id": 175, - "repository_id": null, + "id": 23, + "repository_id": 1, "number": null, "started_at": null, "finished_at": null, @@ -14,15 +14,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2022-04-29 02:56:49 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 37, + "request_id": 7, "state": null, "duration": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json similarity index 88% rename from spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json rename to spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json index 40b5abc..7550e0c 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_build_17-63.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json @@ -2,7 +2,7 @@ "table_name": "deleted_builds", "data": [ { - "id": 17, + "id": 1, "repository_id": null, "number": null, "started_at": null, @@ -14,15 +14,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 11, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -47,7 +47,7 @@ "unique_number": null }, { - "id": 18, + "id": 2, "repository_id": null, "number": null, "started_at": null, @@ -59,15 +59,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 11, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -92,7 +92,7 @@ "unique_number": null }, { - "id": 61, + "id": 7, "repository_id": null, "number": null, "started_at": null, @@ -104,15 +104,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 35, + "request_id": 5, "state": null, "duration": null, "owner_type": null, @@ -137,7 +137,7 @@ "unique_number": null }, { - "id": 62, + "id": 8, "repository_id": null, "number": null, "started_at": null, @@ -149,15 +149,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 35, + "request_id": 5, "state": null, "duration": null, "owner_type": null, @@ -182,7 +182,7 @@ "unique_number": null }, { - "id": 63, + "id": 9, "repository_id": null, "number": null, "started_at": null, @@ -194,15 +194,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 37, + "request_id": 7, "state": null, "duration": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json similarity index 88% rename from spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json rename to spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json index 07e0969..3cc6c89 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_build_64-64.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json @@ -2,7 +2,7 @@ "table_name": "deleted_builds", "data": [ { - "id": 64, + "id": 10, "repository_id": null, "number": null, "started_at": null, @@ -14,15 +14,15 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "ref": null, "branch": null, "github_payload": null, "compare_url": null, "token": null, "commit_id": null, - "request_id": 37, + "request_id": 7, "state": null, "duration": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json similarity index 84% rename from spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json rename to spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json index 4832e59..ef7576e 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_job_16-57.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json @@ -2,11 +2,11 @@ "table_name": "deleted_jobs", "data": [ { - "id": 16, + "id": 1, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 11, + "source_id": 1, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -36,11 +36,11 @@ "priority": null }, { - "id": 17, + "id": 2, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 11, + "source_id": 1, "queue": null, "type": null, "state": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -70,11 +70,11 @@ "priority": null }, { - "id": 53, + "id": 5, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 35, + "source_id": 5, "queue": null, "type": null, "state": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -104,11 +104,11 @@ "priority": null }, { - "id": 54, + "id": 6, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 35, + "source_id": 5, "queue": null, "type": null, "state": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -138,11 +138,11 @@ "priority": null }, { - "id": 57, + "id": 9, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 37, + "source_id": 7, "queue": null, "type": null, "state": null, @@ -151,8 +151,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json similarity index 84% rename from spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json rename to spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json index 9d7a425..d48a3f1 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_job_58-58.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json @@ -2,11 +2,11 @@ "table_name": "deleted_jobs", "data": [ { - "id": 58, + "id": 10, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 37, + "source_id": 7, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json similarity index 53% rename from spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json rename to spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json index 80fdbba..1eec0f3 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_9-33.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json @@ -2,43 +2,43 @@ "table_name": "deleted_request_payloads", "data": [ { - "id": 9, - "request_id": 11, + "id": 1, + "request_id": 1, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 10, - "request_id": 11, + "id": 2, + "request_id": 1, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 31, - "request_id": 35, + "id": 5, + "request_id": 5, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 32, - "request_id": 35, + "id": 6, + "request_id": 5, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 33, - "request_id": 37, + "id": 7, + "request_id": 7, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json similarity index 62% rename from spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json rename to spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json index e76f28e..ef341fd 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_34-34.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json @@ -2,11 +2,11 @@ "table_name": "deleted_request_payloads", "data": [ { - "id": 34, - "request_id": 37, + "id": 8, + "request_id": 7, "payload": null, "archived": null, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_1-7.json similarity index 80% rename from spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json rename to spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_1-7.json index 0d6310c..9ec1b07 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_9-35.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_1-7.json @@ -2,40 +2,40 @@ "table_name": "deleted_request_raw_configurations", "data": [ { - "id": 9, - "request_id": 11, + "id": 1, + "request_id": 1, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 10, - "request_id": 11, + "id": 2, + "request_id": 1, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 31, - "request_id": 35, + "id": 5, + "request_id": 5, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 32, - "request_id": 35, + "id": 6, + "request_id": 5, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 35, - "request_id": 37, + "id": 7, + "request_id": 7, "request_raw_config_id": null, "source": null, "org_id": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_8-8.json similarity index 82% rename from spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json rename to spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_8-8.json index 58bb5e3..56c1842 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_36-36.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_8-8.json @@ -2,8 +2,8 @@ "table_name": "deleted_request_raw_configurations", "data": [ { - "id": 36, - "request_id": 37, + "id": 8, + "request_id": 7, "request_raw_config_id": null, "source": null, "org_id": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_170-177.json b/spec/support/expected_files/remove_repo_requests/job_18-25.json similarity index 84% rename from spec/support/expected_files/remove_repo_requests/job_170-177.json rename to spec/support/expected_files/remove_repo_requests/job_18-25.json index 45fc37a..01548c6 100644 --- a/spec/support/expected_files/remove_repo_requests/job_170-177.json +++ b/spec/support/expected_files/remove_repo_requests/job_18-25.json @@ -2,11 +2,11 @@ "table_name": "jobs", "data": [ { - "id": 170, + "id": 18, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 35, + "source_id": 5, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -36,11 +36,11 @@ "priority": null }, { - "id": 174, + "id": 22, "repository_id": null, "commit_id": null, "source_type": "Build", - "source_id": 173, + "source_id": 21, "queue": null, "type": null, "state": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -70,11 +70,11 @@ "priority": null }, { - "id": 176, + "id": 24, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 37, + "source_id": 7, "queue": null, "type": null, "state": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -104,11 +104,11 @@ "priority": null }, { - "id": 177, + "id": 25, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 37, + "source_id": 7, "queue": null, "type": null, "state": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_53-169.json b/spec/support/expected_files/remove_repo_requests/job_2-17.json similarity index 84% rename from spec/support/expected_files/remove_repo_requests/job_53-169.json rename to spec/support/expected_files/remove_repo_requests/job_2-17.json index 8f2e013..0723fdf 100644 --- a/spec/support/expected_files/remove_repo_requests/job_53-169.json +++ b/spec/support/expected_files/remove_repo_requests/job_2-17.json @@ -2,11 +2,11 @@ "table_name": "jobs", "data": [ { - "id": 53, + "id": 2, "repository_id": null, "commit_id": null, "source_type": "Build", - "source_id": 52, + "source_id": 1, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -36,11 +36,11 @@ "priority": null }, { - "id": 55, + "id": 4, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 11, + "source_id": 1, "queue": null, "type": null, "state": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -70,11 +70,11 @@ "priority": null }, { - "id": 56, + "id": 5, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 11, + "source_id": 1, "queue": null, "type": null, "state": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -104,11 +104,11 @@ "priority": null }, { - "id": 167, + "id": 15, "repository_id": null, "commit_id": null, "source_type": "Build", - "source_id": 166, + "source_id": 14, "queue": null, "type": null, "state": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -138,11 +138,11 @@ "priority": null }, { - "id": 169, + "id": 17, "repository_id": null, "commit_id": null, "source_type": "Request", - "source_id": 35, + "source_id": 5, "queue": null, "type": null, "state": null, @@ -151,8 +151,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "tags": null, "allow_failure": false, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_config_2-2.json b/spec/support/expected_files/remove_repo_requests/job_config_2-2.json deleted file mode 100644 index 98d2d1e..0000000 --- a/spec/support/expected_files/remove_repo_requests/job_config_2-2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "table_name": "job_configs", - "data": [ - { - "id": 2, - "repository_id": 1, - "key": "some_test_key", - "org_id": null, - "com_id": null, - "config": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/job_version_1-67.json b/spec/support/expected_files/remove_repo_requests/job_version_1-9.json similarity index 72% rename from spec/support/expected_files/remove_repo_builds/job_version_1-67.json rename to spec/support/expected_files/remove_repo_requests/job_version_1-9.json index f9d6a63..92e1d02 100644 --- a/spec/support/expected_files/remove_repo_builds/job_version_1-67.json +++ b/spec/support/expected_files/remove_repo_requests/job_version_1-9.json @@ -3,10 +3,10 @@ "data": [ { "id": 1, - "job_id": 6, + "job_id": 4, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -15,10 +15,10 @@ }, { "id": 2, - "job_id": 6, + "job_id": 4, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -26,11 +26,11 @@ "restarted_at": null }, { - "id": 63, - "job_id": 183, + "id": 5, + "job_id": 17, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -38,11 +38,11 @@ "restarted_at": null }, { - "id": 64, - "job_id": 183, + "id": 6, + "job_id": 17, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -50,11 +50,11 @@ "restarted_at": null }, { - "id": 67, - "job_id": 197, + "id": 9, + "job_id": 24, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, diff --git a/spec/support/expected_files/remove_repo_builds/job_version_68-68.json b/spec/support/expected_files/remove_repo_requests/job_version_10-10.json similarity index 73% rename from spec/support/expected_files/remove_repo_builds/job_version_68-68.json rename to spec/support/expected_files/remove_repo_requests/job_version_10-10.json index b41893e..f1605fc 100644 --- a/spec/support/expected_files/remove_repo_builds/job_version_68-68.json +++ b/spec/support/expected_files/remove_repo_requests/job_version_10-10.json @@ -2,11 +2,11 @@ "table_name": "job_versions", "data": [ { - "id": 68, - "job_id": 197, + "id": 10, + "job_id": 24, "number": null, "state": null, - "created_at": "2021-08-23 20:23:56 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "queued_at": null, "received_at": null, "started_at": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_version_17-61.json b/spec/support/expected_files/remove_repo_requests/job_version_17-61.json deleted file mode 100644 index 1eb8e6d..0000000 --- a/spec/support/expected_files/remove_repo_requests/job_version_17-61.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "table_name": "job_versions", - "data": [ - { - "id": 17, - "job_id": 55, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - }, - { - "id": 18, - "job_id": 55, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - }, - { - "id": 57, - "job_id": 169, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - }, - { - "id": 58, - "job_id": 169, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - }, - { - "id": 61, - "job_id": 176, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/job_version_62-62.json b/spec/support/expected_files/remove_repo_requests/job_version_62-62.json deleted file mode 100644 index 07b53c8..0000000 --- a/spec/support/expected_files/remove_repo_requests/job_version_62-62.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "table_name": "job_versions", - "data": [ - { - "id": 62, - "job_id": 176, - "number": null, - "state": null, - "created_at": "2021-09-27 06:59:20 UTC", - "queued_at": null, - "received_at": null, - "started_at": null, - "finished_at": null, - "restarted_at": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/message_9-33.json b/spec/support/expected_files/remove_repo_requests/message_1-7.json similarity index 60% rename from spec/support/expected_files/remove_repo_requests/message_9-33.json rename to spec/support/expected_files/remove_repo_requests/message_1-7.json index abd073c..6e1bf72 100644 --- a/spec/support/expected_files/remove_repo_requests/message_9-33.json +++ b/spec/support/expected_files/remove_repo_requests/message_1-7.json @@ -2,71 +2,71 @@ "table_name": "messages", "data": [ { - "id": 9, - "subject_id": 11, + "id": 1, + "subject_id": 1, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null }, { - "id": 10, - "subject_id": 11, + "id": 2, + "subject_id": 1, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null }, { - "id": 31, - "subject_id": 35, + "id": 5, + "subject_id": 5, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null }, { - "id": 32, - "subject_id": 35, + "id": 6, + "subject_id": 5, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null }, { - "id": 33, - "subject_id": 37, + "id": 7, + "subject_id": 7, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null diff --git a/spec/support/expected_files/remove_repo_requests/message_34-34.json b/spec/support/expected_files/remove_repo_requests/message_8-8.json similarity index 63% rename from spec/support/expected_files/remove_repo_requests/message_34-34.json rename to spec/support/expected_files/remove_repo_requests/message_8-8.json index 73c17c8..ee18086 100644 --- a/spec/support/expected_files/remove_repo_requests/message_34-34.json +++ b/spec/support/expected_files/remove_repo_requests/message_8-8.json @@ -2,15 +2,15 @@ "table_name": "messages", "data": [ { - "id": 34, - "subject_id": 37, + "id": 8, + "subject_id": 7, "subject_type": "Request", "level": null, "key": null, "code": null, "args": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "type": null, "src": null, "line": null diff --git a/spec/support/expected_files/remove_repo_builds/queueable_job_1-67.json b/spec/support/expected_files/remove_repo_requests/queueable_job_1-9.json similarity index 50% rename from spec/support/expected_files/remove_repo_builds/queueable_job_1-67.json rename to spec/support/expected_files/remove_repo_requests/queueable_job_1-9.json index 19a23ae..d4c6191 100644 --- a/spec/support/expected_files/remove_repo_builds/queueable_job_1-67.json +++ b/spec/support/expected_files/remove_repo_requests/queueable_job_1-9.json @@ -3,23 +3,23 @@ "data": [ { "id": 1, - "job_id": 6 + "job_id": 4 }, { "id": 2, - "job_id": 6 + "job_id": 4 }, { - "id": 63, - "job_id": 183 + "id": 5, + "job_id": 17 }, { - "id": 64, - "job_id": 183 + "id": 6, + "job_id": 17 }, { - "id": 67, - "job_id": 197 + "id": 9, + "job_id": 24 } ] } \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_builds/queueable_job_68-68.json b/spec/support/expected_files/remove_repo_requests/queueable_job_10-10.json similarity index 64% rename from spec/support/expected_files/remove_repo_builds/queueable_job_68-68.json rename to spec/support/expected_files/remove_repo_requests/queueable_job_10-10.json index e91293a..2f0ed9f 100644 --- a/spec/support/expected_files/remove_repo_builds/queueable_job_68-68.json +++ b/spec/support/expected_files/remove_repo_requests/queueable_job_10-10.json @@ -2,8 +2,8 @@ "table_name": "queueable_jobs", "data": [ { - "id": 68, - "job_id": 197 + "id": 10, + "job_id": 24 } ] } \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json b/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json deleted file mode 100644 index 1e11c21..0000000 --- a/spec/support/expected_files/remove_repo_requests/queueable_job_17-61.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "table_name": "queueable_jobs", - "data": [ - { - "id": 17, - "job_id": 55 - }, - { - "id": 18, - "job_id": 55 - }, - { - "id": 57, - "job_id": 169 - }, - { - "id": 58, - "job_id": 169 - }, - { - "id": 61, - "job_id": 176 - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json b/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json deleted file mode 100644 index 52e24dc..0000000 --- a/spec/support/expected_files/remove_repo_requests/queueable_job_62-62.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "table_name": "queueable_jobs", - "data": [ - { - "id": 62, - "job_id": 176 - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_11-37.json b/spec/support/expected_files/remove_repo_requests/request_1-7.json similarity index 87% rename from spec/support/expected_files/remove_repo_requests/request_11-37.json rename to spec/support/expected_files/remove_repo_requests/request_1-7.json index 4590b1f..5531446 100644 --- a/spec/support/expected_files/remove_repo_requests/request_11-37.json +++ b/spec/support/expected_files/remove_repo_requests/request_1-7.json @@ -2,7 +2,7 @@ "table_name": "requests", "data": [ { - "id": 11, + "id": 1, "repository_id": 1, "commit_id": null, "state": null, @@ -10,8 +10,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -34,7 +34,7 @@ "pull_request_mergeable": null }, { - "id": 12, + "id": 2, "repository_id": 1, "commit_id": null, "state": null, @@ -42,8 +42,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -66,7 +66,7 @@ "pull_request_mergeable": null }, { - "id": 35, + "id": 5, "repository_id": 1, "commit_id": null, "state": null, @@ -74,8 +74,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2022-04-27 06:59:25 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -98,7 +98,7 @@ "pull_request_mergeable": null }, { - "id": 36, + "id": 6, "repository_id": 1, "commit_id": null, "state": null, @@ -106,8 +106,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2022-04-27 06:59:25 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -130,7 +130,7 @@ "pull_request_mergeable": null }, { - "id": 37, + "id": 7, "repository_id": 1, "commit_id": null, "state": null, @@ -138,8 +138,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2022-04-27 06:59:25 UTC", + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", "event_type": null, "comments_url": null, "base_commit": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_38-39.json b/spec/support/expected_files/remove_repo_requests/request_38-39.json deleted file mode 100644 index 45c0ce1..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_38-39.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "table_name": "requests", - "data": [ - { - "id": 38, - "repository_id": 1, - "commit_id": null, - "state": null, - "source": null, - "token": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2022-04-27 06:59:25 UTC", - "event_type": null, - "comments_url": null, - "base_commit": null, - "head_commit": null, - "owner_type": null, - "owner_id": null, - "result": null, - "message": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "yaml_config_id": 1, - "github_guid": null, - "pull_request_mergeable": null - }, - { - "id": 39, - "repository_id": 1, - "commit_id": null, - "state": null, - "source": null, - "token": null, - "started_at": null, - "finished_at": null, - "created_at": "2021-09-27 06:59:20 UTC", - "updated_at": "2021-09-27 06:59:20 UTC", - "event_type": null, - "comments_url": null, - "base_commit": null, - "head_commit": null, - "owner_type": null, - "owner_id": null, - "result": null, - "message": null, - "private": null, - "pull_request_id": null, - "branch_id": null, - "tag_id": null, - "sender_type": null, - "sender_id": null, - "org_id": null, - "com_id": null, - "config_id": null, - "yaml_config_id": null, - "github_guid": null, - "pull_request_mergeable": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_8-8.json b/spec/support/expected_files/remove_repo_requests/request_8-8.json new file mode 100644 index 0000000..0e0affa --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_8-8.json @@ -0,0 +1,37 @@ +{ + "table_name": "requests", + "data": [ + { + "id": 8, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "created_at": "2021-09-29 02:56:48 UTC", + "updated_at": "2021-09-29 02:56:48 UTC", + "event_type": null, + "comments_url": null, + "base_commit": null, + "head_commit": null, + "owner_type": null, + "owner_id": null, + "result": null, + "message": null, + "private": null, + "pull_request_id": null, + "branch_id": null, + "tag_id": null, + "sender_type": null, + "sender_id": null, + "org_id": null, + "com_id": null, + "config_id": null, + "yaml_config_id": 1, + "github_guid": null, + "pull_request_mergeable": null + } + ] +} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_config_2-2.json b/spec/support/expected_files/remove_repo_requests/request_config_1-1.json similarity index 75% rename from spec/support/expected_files/remove_repo_requests/build_config_2-2.json rename to spec/support/expected_files/remove_repo_requests/request_config_1-1.json index 49685e2..dc25495 100644 --- a/spec/support/expected_files/remove_repo_requests/build_config_2-2.json +++ b/spec/support/expected_files/remove_repo_requests/request_config_1-1.json @@ -1,8 +1,8 @@ { - "table_name": "build_configs", + "table_name": "request_configs", "data": [ { - "id": 2, + "id": 1, "repository_id": 1, "key": "some_test_key", "org_id": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_config_1-2.json b/spec/support/expected_files/remove_repo_requests/request_config_1-2.json deleted file mode 100644 index 3721f6a..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_config_1-2.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "table_name": "request_configs", - "data": [ - { - "id": 1, - "repository_id": 1, - "key": "some_test_key", - "org_id": null, - "com_id": null, - "config": null - }, - { - "id": 2, - "repository_id": 1, - "key": "some_test_key", - "org_id": null, - "com_id": null, - "config": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_9-33.json b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json similarity index 53% rename from spec/support/expected_files/remove_repo_requests/request_payload_9-33.json rename to spec/support/expected_files/remove_repo_requests/request_payload_1-7.json index 6918f6b..af42232 100644 --- a/spec/support/expected_files/remove_repo_requests/request_payload_9-33.json +++ b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json @@ -2,43 +2,43 @@ "table_name": "request_payloads", "data": [ { - "id": 9, - "request_id": 11, + "id": 1, + "request_id": 1, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 10, - "request_id": 11, + "id": 2, + "request_id": 1, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 31, - "request_id": 35, + "id": 5, + "request_id": 5, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 32, - "request_id": 35, + "id": 6, + "request_id": 5, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null }, { - "id": 33, - "request_id": 37, + "id": 7, + "request_id": 7, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_34-34.json b/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json similarity index 60% rename from spec/support/expected_files/remove_repo_requests/request_payload_34-34.json rename to spec/support/expected_files/remove_repo_requests/request_payload_8-8.json index 36d9ae7..64f8756 100644 --- a/spec/support/expected_files/remove_repo_requests/request_payload_34-34.json +++ b/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json @@ -2,11 +2,11 @@ "table_name": "request_payloads", "data": [ { - "id": 34, - "request_id": 37, + "id": 8, + "request_id": 7, "payload": null, "archived": false, - "created_at": "2021-09-27 06:59:20 UTC", + "created_at": "2021-09-29 02:56:48 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json b/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json deleted file mode 100644 index c2d69f6..0000000 --- a/spec/support/expected_files/remove_repo_requests/request_raw_config_2-2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "table_name": "request_raw_configs", - "data": [ - { - "id": 2, - "config": null, - "repository_id": 1, - "key": "some_test_key", - "org_id": null - } - ] -} \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_1-7.json similarity index 80% rename from spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json rename to spec/support/expected_files/remove_repo_requests/request_raw_configuration_1-7.json index fb985bd..c0fd82e 100644 --- a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_9-35.json +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_1-7.json @@ -2,40 +2,40 @@ "table_name": "request_raw_configurations", "data": [ { - "id": 9, - "request_id": 11, + "id": 1, + "request_id": 1, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 10, - "request_id": 11, + "id": 2, + "request_id": 1, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 31, - "request_id": 35, + "id": 5, + "request_id": 5, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 32, - "request_id": 35, + "id": 6, + "request_id": 5, "request_raw_config_id": null, "source": null, "org_id": null, "merge_mode": null }, { - "id": 35, - "request_id": 37, + "id": 7, + "request_id": 7, "request_raw_config_id": null, "source": null, "org_id": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_8-8.json similarity index 82% rename from spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json rename to spec/support/expected_files/remove_repo_requests/request_raw_configuration_8-8.json index 35c4f03..c263ef5 100644 --- a/spec/support/expected_files/remove_repo_requests/request_raw_configuration_36-36.json +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_8-8.json @@ -2,8 +2,8 @@ "table_name": "request_raw_configurations", "data": [ { - "id": 36, - "request_id": 37, + "id": 8, + "request_id": 7, "request_raw_config_id": null, "source": null, "org_id": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-1.json similarity index 58% rename from spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json rename to spec/support/expected_files/remove_repo_requests/request_yaml_config_1-1.json index 568e31b..4dd2635 100644 --- a/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-2.json +++ b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-1.json @@ -8,14 +8,6 @@ "key": "some_test_key", "org_id": null, "com_id": null - }, - { - "id": 2, - "yaml": null, - "repository_id": 1, - "key": "some_test_key", - "org_id": null, - "com_id": null } ] } \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/stage_12-37.json b/spec/support/expected_files/remove_repo_requests/stage_1-5.json similarity index 82% rename from spec/support/expected_files/remove_repo_requests/stage_12-37.json rename to spec/support/expected_files/remove_repo_requests/stage_1-5.json index 70cb448..d7a9fa7 100644 --- a/spec/support/expected_files/remove_repo_requests/stage_12-37.json +++ b/spec/support/expected_files/remove_repo_requests/stage_1-5.json @@ -2,8 +2,8 @@ "table_name": "stages", "data": [ { - "id": 12, - "build_id": 52, + "id": 1, + "build_id": 1, "number": null, "name": null, "state": null, @@ -13,8 +13,8 @@ "com_id": null }, { - "id": 36, - "build_id": 166, + "id": 4, + "build_id": 14, "number": null, "name": null, "state": null, @@ -24,8 +24,8 @@ "com_id": null }, { - "id": 37, - "build_id": 173, + "id": 5, + "build_id": 21, "number": null, "name": null, "state": null, From d5f1e93f3a01b87d7158a1df1eade8e0fcb95325 Mon Sep 17 00:00:00 2001 From: Karol Selak Travis Date: Fri, 29 Apr 2022 11:45:12 +0200 Subject: [PATCH 11/11] fixes and cleanup --- lib/db_helper.rb | 6 +- spec/backup/remove_specified_spec.rb | 1 - spec/backup_spec.rb | 8 +- .../remove_repo_requests/abuse_1-7.json | 20 ++--- .../remove_repo_requests/abuse_8-8.json | 4 +- .../remove_repo_requests/build_1-21.json | 20 ++--- .../remove_repo_requests/build_23-23.json | 4 +- .../deleted_build_1-9.json | 20 ++--- .../deleted_build_10-10.json | 4 +- .../remove_repo_requests/deleted_job_1-9.json | 20 ++--- .../deleted_job_10-10.json | 4 +- .../deleted_request_payload_1-7.json | 10 +-- .../deleted_request_payload_8-8.json | 2 +- .../remove_repo_requests/job_18-25.json | 16 ++-- .../remove_repo_requests/job_2-17.json | 20 ++--- .../remove_repo_requests/job_version_1-9.json | 10 +-- .../job_version_10-10.json | 2 +- .../remove_repo_requests/message_1-7.json | 20 ++--- .../remove_repo_requests/message_8-8.json | 4 +- .../remove_repo_requests/request_1-7.json | 20 ++--- .../remove_repo_requests/request_8-8.json | 4 +- .../request_payload_1-7.json | 10 +-- .../request_payload_8-8.json | 2 +- spec/support/factories/organization.rb | 14 ---- spec/support/factories/repository.rb | 74 ++----------------- spec/support/factories/user.rb | 14 ---- 26 files changed, 123 insertions(+), 210 deletions(-) diff --git a/lib/db_helper.rb b/lib/db_helper.rb index aa80d0a..c7ff20c 100644 --- a/lib/db_helper.rb +++ b/lib/db_helper.rb @@ -18,10 +18,14 @@ def do_in_other_db(config_or_url) result end - def do_without_triggers + def self.do_without_triggers ActiveRecord::Base.connection.execute('set session_replication_role = replica;') result = yield ActiveRecord::Base.connection.execute('set session_replication_role = default;') result end + + def do_without_triggers(&block) + self.class.do_without_triggers(&block) + end end \ No newline at end of file diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index d4f649a..a818002 100644 --- a/spec/backup/remove_specified_spec.rb +++ b/spec/backup/remove_specified_spec.rb @@ -154,7 +154,6 @@ it 'removes requests with all its dependencies' do dependency_tree = repository.dependency_tree remove_specified.remove_repo_requests(repository) - puts JSON.pretty_generate dependency_tree.status_tree_condensed expect(dependency_tree.status_tree_condensed).to eql(ExpectedDependencyTrees.remove_repo_requests) end diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index a1b641e..4d93f32 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb @@ -18,7 +18,9 @@ describe 'run' do let!(:unassigned_repositories) { - FactoryBot.create_list(:repository, 3) + DbHelper.do_without_triggers do + FactoryBot.create_list(:repository_for_removing_heavy_data, 3) + end } let!(:user1) { FactoryBot.create(:user) @@ -139,8 +141,8 @@ it 'prepares proper dry run report' do backup.run expect(backup.dry_run_report[:builds].size).to eql 24 - expect(backup.dry_run_report[:jobs].size).to eql 48 - expect(backup.dry_run_report[:requests].size).to eql 6 + expect(backup.dry_run_report[:jobs].size).to eql 36 + expect(backup.dry_run_report[:requests].size).to eql 24 end it 'prints dry run report' do diff --git a/spec/support/expected_files/remove_repo_requests/abuse_1-7.json b/spec/support/expected_files/remove_repo_requests/abuse_1-7.json index a34efec..296df70 100644 --- a/spec/support/expected_files/remove_repo_requests/abuse_1-7.json +++ b/spec/support/expected_files/remove_repo_requests/abuse_1-7.json @@ -8,8 +8,8 @@ "request_id": 1, "level": 1, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" }, { "id": 2, @@ -18,8 +18,8 @@ "request_id": 1, "level": 2, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" }, { "id": 5, @@ -28,8 +28,8 @@ "request_id": 5, "level": 5, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" }, { "id": 6, @@ -38,8 +38,8 @@ "request_id": 5, "level": 6, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" }, { "id": 7, @@ -48,8 +48,8 @@ "request_id": 7, "level": 7, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" } ] } \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/abuse_8-8.json b/spec/support/expected_files/remove_repo_requests/abuse_8-8.json index 4aca7e2..eb9075b 100644 --- a/spec/support/expected_files/remove_repo_requests/abuse_8-8.json +++ b/spec/support/expected_files/remove_repo_requests/abuse_8-8.json @@ -8,8 +8,8 @@ "request_id": 7, "level": 8, "reason": "some text", - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC" + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" } ] } \ No newline at end of file diff --git a/spec/support/expected_files/remove_repo_requests/build_1-21.json b/spec/support/expected_files/remove_repo_requests/build_1-21.json index 2a2a008..704c050 100644 --- a/spec/support/expected_files/remove_repo_requests/build_1-21.json +++ b/spec/support/expected_files/remove_repo_requests/build_1-21.json @@ -14,8 +14,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, @@ -59,8 +59,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, @@ -104,8 +104,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, @@ -149,8 +149,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, @@ -194,8 +194,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, diff --git a/spec/support/expected_files/remove_repo_requests/build_23-23.json b/spec/support/expected_files/remove_repo_requests/build_23-23.json index 82c97ac..b3d4c24 100644 --- a/spec/support/expected_files/remove_repo_requests/build_23-23.json +++ b/spec/support/expected_files/remove_repo_requests/build_23-23.json @@ -14,8 +14,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2022-04-29 02:56:49 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", "ref": null, "branch": null, "github_payload": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json index 7550e0c..55818b6 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json @@ -14,8 +14,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, @@ -59,8 +59,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, @@ -104,8 +104,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, @@ -149,8 +149,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, @@ -194,8 +194,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json index 3cc6c89..450adf4 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json @@ -14,8 +14,8 @@ "committer_email": null, "author_name": null, "author_email": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "ref": null, "branch": null, "github_payload": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json index ef7576e..97e7ecd 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, @@ -151,8 +151,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json index d48a3f1..6aa7cdb 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": null, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json index 1eec0f3..8c013b0 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json @@ -6,7 +6,7 @@ "request_id": 1, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -14,7 +14,7 @@ "request_id": 1, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -22,7 +22,7 @@ "request_id": 5, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -30,7 +30,7 @@ "request_id": 5, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -38,7 +38,7 @@ "request_id": 7, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json index ef341fd..f9e2163 100644 --- a/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json @@ -6,7 +6,7 @@ "request_id": 7, "payload": null, "archived": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/job_18-25.json b/spec/support/expected_files/remove_repo_requests/job_18-25.json index 01548c6..f8f3db9 100644 --- a/spec/support/expected_files/remove_repo_requests/job_18-25.json +++ b/spec/support/expected_files/remove_repo_requests/job_18-25.json @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_2-17.json b/spec/support/expected_files/remove_repo_requests/job_2-17.json index 0723fdf..736879d 100644 --- a/spec/support/expected_files/remove_repo_requests/job_2-17.json +++ b/spec/support/expected_files/remove_repo_requests/job_2-17.json @@ -15,8 +15,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -49,8 +49,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -83,8 +83,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -117,8 +117,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, @@ -151,8 +151,8 @@ "worker": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, "allow_failure": false, "owner_type": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_version_1-9.json b/spec/support/expected_files/remove_repo_requests/job_version_1-9.json index 92e1d02..501bebd 100644 --- a/spec/support/expected_files/remove_repo_requests/job_version_1-9.json +++ b/spec/support/expected_files/remove_repo_requests/job_version_1-9.json @@ -6,7 +6,7 @@ "job_id": 4, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -18,7 +18,7 @@ "job_id": 4, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -30,7 +30,7 @@ "job_id": 17, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -42,7 +42,7 @@ "job_id": 17, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, @@ -54,7 +54,7 @@ "job_id": 24, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, diff --git a/spec/support/expected_files/remove_repo_requests/job_version_10-10.json b/spec/support/expected_files/remove_repo_requests/job_version_10-10.json index f1605fc..870d96b 100644 --- a/spec/support/expected_files/remove_repo_requests/job_version_10-10.json +++ b/spec/support/expected_files/remove_repo_requests/job_version_10-10.json @@ -6,7 +6,7 @@ "job_id": 24, "number": null, "state": null, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, diff --git a/spec/support/expected_files/remove_repo_requests/message_1-7.json b/spec/support/expected_files/remove_repo_requests/message_1-7.json index 6e1bf72..e1d853a 100644 --- a/spec/support/expected_files/remove_repo_requests/message_1-7.json +++ b/spec/support/expected_files/remove_repo_requests/message_1-7.json @@ -9,8 +9,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null @@ -23,8 +23,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null @@ -37,8 +37,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null @@ -51,8 +51,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null @@ -65,8 +65,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null diff --git a/spec/support/expected_files/remove_repo_requests/message_8-8.json b/spec/support/expected_files/remove_repo_requests/message_8-8.json index ee18086..e071ebe 100644 --- a/spec/support/expected_files/remove_repo_requests/message_8-8.json +++ b/spec/support/expected_files/remove_repo_requests/message_8-8.json @@ -9,8 +9,8 @@ "key": null, "code": null, "args": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "type": null, "src": null, "line": null diff --git a/spec/support/expected_files/remove_repo_requests/request_1-7.json b/spec/support/expected_files/remove_repo_requests/request_1-7.json index 5531446..ede8e2d 100644 --- a/spec/support/expected_files/remove_repo_requests/request_1-7.json +++ b/spec/support/expected_files/remove_repo_requests/request_1-7.json @@ -10,8 +10,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -42,8 +42,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -74,8 +74,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -106,8 +106,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, @@ -138,8 +138,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_8-8.json b/spec/support/expected_files/remove_repo_requests/request_8-8.json index 0e0affa..f5222aa 100644 --- a/spec/support/expected_files/remove_repo_requests/request_8-8.json +++ b/spec/support/expected_files/remove_repo_requests/request_8-8.json @@ -10,8 +10,8 @@ "token": null, "started_at": null, "finished_at": null, - "created_at": "2021-09-29 02:56:48 UTC", - "updated_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "event_type": null, "comments_url": null, "base_commit": null, diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json index af42232..637e5ae 100644 --- a/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json +++ b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json @@ -6,7 +6,7 @@ "request_id": 1, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -14,7 +14,7 @@ "request_id": 1, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -22,7 +22,7 @@ "request_id": 5, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -30,7 +30,7 @@ "request_id": 5, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null }, { @@ -38,7 +38,7 @@ "request_id": 7, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null } ] diff --git a/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json b/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json index 64f8756..ab473ad 100644 --- a/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json +++ b/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json @@ -6,7 +6,7 @@ "request_id": 7, "payload": null, "archived": false, - "created_at": "2021-09-29 02:56:48 UTC", + "created_at": "2021-09-29 02:58:47 UTC", "org_id": null } ] diff --git a/spec/support/factories/organization.rb b/spec/support/factories/organization.rb index 4ba1f89..a9e687b 100644 --- a/spec/support/factories/organization.rb +++ b/spec/support/factories/organization.rb @@ -5,20 +5,6 @@ FactoryBot.define do factory :organization do - factory :organization_with_repos do - transient do - repos_count { 3 } - end - after(:create) do |organization, evaluator| - create_list( - :repository_with_builds_jobs_and_logs, - evaluator.repos_count, - owner_id: organization.id, - owner_type: 'Organization' - ) - end - end - factory :organization_with_all_dependencies do after(:create) do |organization| create_list( diff --git a/spec/support/factories/repository.rb b/spec/support/factories/repository.rb index a8378a7..2ec3fd2 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -21,67 +21,6 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) FactoryBot.define do factory :repository do - factory :repository_with_builds_jobs_and_logs do - transient do - builds_count { 2 } - end - after(:create) do |repository, evaluator| - create_list( - :build_with_jobs, - evaluator.builds_count, - repository: repository, - created_at: repository.created_at, - updated_at: repository.updated_at - ) - end - end - - factory :repository_with_builds do - transient do - builds_count { 2 } - end - after(:create) do |repository, evaluator| - create_list( - :build, - evaluator.builds_count, - repository: repository, - created_at: repository.created_at, - updated_at: repository.updated_at - ) - end - end - - factory :repository_orphaned_on_current_build_id do - current_build_id { 2_000_000_000 } - end - - factory :repository_with_current_build_id do - current_build_id { Build.first.id } - end - - factory :repository_orphaned_on_last_build_id do - last_build_id { 2_000_000_000 } - end - - factory :repository_with_last_build_id do - last_build_id { Build.first.id } - end - - factory :repository_with_requests do - transient do - requests_count { 2 } - end - after(:create) do |repository, evaluator| - create_list( - :request, - evaluator.requests_count, - repository: repository, - created_at: repository.created_at, - updated_at: repository.updated_at - ) - end - end - factory :repository_with_all_dependencies do after(:create) do |repository| create_for_repo(repository, :build_with_all_dependencies_and_sibling) @@ -129,9 +68,6 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) updated_at { 12.months.ago.to_time.utc } after(:create) do |repository| - # create_for_repo(repository, :build_for_removing_heavy_data) - # create_for_repo_without_timestamps(repository, :build_for_removing_heavy_data) - # last_build = create_for_repo(repository, :build_for_removing_heavy_data).last create_for_repo(repository, :request_with_all_dependencies_and_sibling) create_for_repo_without_timestamps(repository, :request_with_all_dependencies_and_sibling) @@ -141,10 +77,10 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) create_for_repo(repository, :request_yaml_config_with_all_dependencies_and_sibling) create_for_repo_without_timestamps(repository, :request_raw_config_with_all_dependencies_and_sibling) - Repository.record_timestamps = false - Request.record_timestamps = false + Model.record_timestamps = false - # repository.update(last_build_id: repository.id) + # TODO + # repository.update(last_build_id: ) repository.request_configs.each do |config| config.requests.each do |request| @@ -152,6 +88,7 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) end end + # TODO # repository.request_raw_configs.each do |config| # config.request_raw_configurations.each do |configuration| # configuration.requests.each do |request| @@ -184,8 +121,7 @@ def create_for_repo_without_timestamps(repository, what, how_many = 1) end end - Repository.record_timestamps = true - Request.record_timestamps = true + Model.record_timestamps = true end end diff --git a/spec/support/factories/user.rb b/spec/support/factories/user.rb index 648f41e..4ab8111 100644 --- a/spec/support/factories/user.rb +++ b/spec/support/factories/user.rb @@ -5,20 +5,6 @@ FactoryBot.define do factory :user do - factory :user_with_repos do - transient do - repos_count { 3 } - end - after(:create) do |user, evaluator| - create_list( - :repository_with_builds_jobs_and_logs, - evaluator.repos_count, - owner_id: user.id, - owner_type: 'User' - ) - end - end - factory :user_with_all_dependencies do after(:create) do |user| create_list(