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/lib/backup/remove_specified/remove_heavy_data.rb b/lib/backup/remove_specified/remove_heavy_data.rb index 632a9c2..7b1666d 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,97 @@ 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 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 = 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 = 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 = 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 = 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 + 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/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/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/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 diff --git a/spec/backup/remove_specified_spec.rb b/spec/backup/remove_specified_spec.rb index a6c73b0..a818002 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 @@ -161,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(-86) end end diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index 65b0711..4d93f32 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb @@ -18,19 +18,21 @@ describe 'run' do let!(:unassigned_repositories) { - FactoryBot.create_list(:repository_with_requests, 3) + DbHelper.do_without_triggers do + FactoryBot.create_list(:repository_for_removing_heavy_data, 3) + end } 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 @@ -84,50 +86,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) } @@ -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_dependency_trees/remove_repo_requests.rb b/spec/support/expected_dependency_trees/remove_repo_requests.rb index 4a6503c..19e74ad 100644 --- a/spec/support/expected_dependency_trees/remove_repo_requests.rb +++ b/spec/support/expected_dependency_trees/remove_repo_requests.rb @@ -4,2289 +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" + "id 1, 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" + "id 1, removed" + ] + }, + "id 3, removed", + { + "_": "id 6, present", + "job": [ + "id 7, present" ], - "deleted_job": [ - "id 15, present" + "repository": [ + "id 5, present", + "id 4, present" ], - "deleted_tag": [ - "id 1, present" + "tag": [ + "id 2, present" ], - "deleted_stage": [ - "id 1, present" + "branch": [ + "id 2, present" + ], + "stage": [ + "id 2, present" ] }, - "id 51, 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 39, removed", - "id 40, present" - ], - "job": [ + "id 2, removed", { - "_": "id 57, present", - "queueable_job": [ - "id 19, present", - "id 20, present" - ], - "job_version": [ - "id 19, present", - "id 20, present" - ] - }, - "id 58, 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 3, present", + "abuse": [ + "id 3, present", + "id 4, present" ], - "cron": [ - "id 2, present" + "message": [ + "id 3, present", + "id 4, present" ], "job": [ { - "_": "id 62, present", + "_": "id 9, present", "queueable_job": [ - "id 21, present", - "id 22, present" + "id 3, present", + "id 4, present" ], "job_version": [ - "id 21, present", - "id 22, present" + "id 3, present", + "id 4, present" ] }, - "id 63, present" + "id 10, present" ], - "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" + "build": [ + "id 6, present, duplicate", + "id 8, present, duplicate" ], - "deleted_build": [ - "id 19, present", - "id 20, present" + "request_payload": [ + "id 3, present", + "id 4, present" ], - "deleted_commit": [ - "id 5, present", - "id 6, present" + "request_raw_configuration": [ + "id 3, present", + "id 4, present" ], "deleted_job": [ - "id 18, present", - "id 19, present" + "id 3, present", + "id 4, present" ], - "deleted_request": [ - "id 11, present", - "id 12, present" + "deleted_build": [ + "id 3, present", + "id 4, present" + ], + "deleted_request_payload": [ + "id 3, present", + "id 4, present" + ], + "deleted_request_raw_configuration": [ + "id 3, present", + "id 4, present" ] }, - "id 19, present" - ], - "ssl_key": [ - "id 3, present", - "id 4, present" - ], - "commit": [ + "id 4, present", { - "_": "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 5, removed", + "abuse": [ + "id 5, removed", + "id 6, removed" + ], + "message": [ + "id 5, removed", + "id 6, removed" ], "job": [ { - "_": "id 82, present", + "_": "id 17, removed", "queueable_job": [ - "id 29, present", - "id 30, present" + "id 5, removed", + "id 6, removed" ], "job_version": [ - "id 29, present", - "id 30, present" + "id 5, removed", + "id 6, removed" ] }, - "id 83, present" + "id 18, removed" ], - "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" + "build": [ + "id 14, removed, duplicate", + "id 16, removed, duplicate" ], - "deleted_build": [ - "id 29, present", - "id 30, present" + "request_payload": [ + "id 5, removed", + "id 6, removed" + ], + "request_raw_configuration": [ + "id 5, removed", + "id 6, removed" ], "deleted_job": [ - "id 28, present", - "id 29, present" + "id 5, removed", + "id 6, removed" ], - "deleted_request": [ - "id 13, present", - "id 14, present" + "deleted_build": [ + "id 7, removed", + "id 8, removed" + ], + "deleted_request_payload": [ + "id 5, removed", + "id 6, removed" + ], + "deleted_request_raw_configuration": [ + "id 5, removed", + "id 6, removed" ] }, - "id 10, present" - ], - "permission": [ - "id 3, present", - "id 4, present" - ], - "star": [ - "id 3, present", - "id 4, present" - ], - "pull_request": [ + "id 6, removed", { - "_": "id 3, present", - "request": [ + "_": "id 7, removed", + "abuse": [ + "id 7, removed", + "id 8, removed" + ], + "message": [ + "id 7, removed", + "id 8, removed" + ], + "job": [ { - "_": "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" + "_": "id 24, removed", + "queueable_job": [ + "id 9, removed", + "id 10, removed" ], - "deleted_request_raw_configuration": [ - "id 25, present", - "id 26, present" + "job_version": [ + "id 9, removed", + "id 10, removed" ] }, - "id 30, present" + "id 25, 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" + "id 21, removed, duplicate", + "id 23, removed, duplicate" ], - "deleted_request": [ - "id 23, present", - "id 24, present" + "request_payload": [ + "id 7, removed", + "id 8, removed" + ], + "request_raw_configuration": [ + "id 7, removed", + "id 8, removed" + ], + "deleted_job": [ + "id 9, removed", + "id 10, removed" ], "deleted_build": [ - "id 49, present", - "id 50, present" + "id 9, removed", + "id 10, removed" + ], + "deleted_request_payload": [ + "id 7, removed", + "id 8, removed" + ], + "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", - "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 11, present, duplicate", + "id 13, present, duplicate" ], "deleted_build": [ - "id 59, present", - "id 60, present" + "id 5, present", + "id 6, present" ] }, "id 2, present" ], - "email_unsubscribe": [ - "id 1, present", - "id 2, present" - ], "request_config": [ { - "_": "id 1, present", + "_": "id 1, removed", "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 5, removed, duplicate", + "id 6, removed, duplicate" ], "deleted_request": [ - "id 29, present", - "id 30, present" + "id 1, present", + "id 2, present" ] }, "id 2, present" @@ -2295,22 +368,12 @@ 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 19, present, duplicate", + "id 20, present, duplicate" ], "deleted_job": [ - "id 55, present", - "id 56, present" + "id 7, present", + "id 8, present" ] }, "id 2, present" @@ -2319,151 +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, present" ], - "repo_count": [ - "id 1, present", - "id 1, present, duplicate" - ], "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 7, removed, duplicate", + "id 8, removed, duplicate" ], "deleted_request": [ - "id 31, present", - "id 32, present" + "id 3, present", + "id 4, present" ] }, "id 2, present" - ], - "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/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/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_requests/abuse_1-7.json b/spec/support/expected_files/remove_repo_requests/abuse_1-7.json new file mode 100644 index 0000000..296df70 --- /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:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" + }, + { + "id": 2, + "owner_type": null, + "owner_id": null, + "request_id": 1, + "level": 2, + "reason": "some text", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" + }, + { + "id": 5, + "owner_type": null, + "owner_id": null, + "request_id": 5, + "level": 5, + "reason": "some text", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" + }, + { + "id": 6, + "owner_type": null, + "owner_id": null, + "request_id": 5, + "level": 6, + "reason": "some text", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC" + }, + { + "id": 7, + "owner_type": null, + "owner_id": null, + "request_id": 7, + "level": 7, + "reason": "some text", + "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 new file mode 100644 index 0000000..eb9075b --- /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: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_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_builds/build_1-192.json b/spec/support/expected_files/remove_repo_requests/build_1-21.json similarity index 71% rename from spec/support/expected_files/remove_repo_builds/build_1-192.json rename to spec/support/expected_files/remove_repo_requests/build_1-21.json index b5a96d6..704c050 100644 --- a/spec/support/expected_files/remove_repo_builds/build_1-192.json +++ b/spec/support/expected_files/remove_repo_requests/build_1-21.json @@ -14,15 +14,15 @@ "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", + "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, "compare_url": null, "token": null, "commit_id": null, - "request_id": null, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -47,7 +47,7 @@ "unique_number": null }, { - "id": 51, + "id": 3, "repository_id": 1, "number": null, "started_at": null, @@ -59,15 +59,15 @@ "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", + "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, "compare_url": null, "token": null, "commit_id": null, - "request_id": null, + "request_id": 1, "state": null, "duration": null, "owner_type": null, @@ -92,7 +92,7 @@ "unique_number": null }, { - "id": 178, + "id": 14, "repository_id": 1, "number": null, "started_at": null, @@ -104,15 +104,15 @@ "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", + "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, "compare_url": null, "token": null, "commit_id": null, - "request_id": null, + "request_id": 5, "state": null, "duration": null, "owner_type": null, @@ -137,7 +137,7 @@ "unique_number": null }, { - "id": 192, + "id": 16, "repository_id": 1, "number": null, "started_at": null, @@ -149,15 +149,60 @@ "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", + "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, "compare_url": null, "token": null, "commit_id": null, - "request_id": null, + "request_id": 5, + "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": 21, + "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-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 7, "state": null, "duration": null, "owner_type": 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 new file mode 100644 index 0000000..b3d4c24 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/build_23-23.json @@ -0,0 +1,50 @@ +{ + "table_name": "builds", + "data": [ + { + "id": 23, + "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-09-29 02:58:47 UTC", + "updated_at": "2022-04-29 02:58:49 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 7, + "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-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_1-9.json b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json new file mode 100644 index 0000000..55818b6 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_1-9.json @@ -0,0 +1,230 @@ +{ + "table_name": "deleted_builds", + "data": [ + { + "id": 1, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 1, + "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": 2, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 1, + "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": 7, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 5, + "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": 8, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 5, + "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": 9, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 7, + "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_10-10.json b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json new file mode 100644 index 0000000..450adf4 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_build_10-10.json @@ -0,0 +1,50 @@ +{ + "table_name": "deleted_builds", + "data": [ + { + "id": 10, + "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-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "ref": null, + "branch": null, + "github_payload": null, + "compare_url": null, + "token": null, + "commit_id": null, + "request_id": 7, + "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_builds/job_2-6.json b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json similarity index 73% rename from spec/support/expected_files/remove_repo_builds/job_2-6.json rename to spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json index 431fc30..97e7ecd 100644 --- a/spec/support/expected_files/remove_repo_builds/job_2-6.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_1-9.json @@ -1,24 +1,24 @@ { - "table_name": "jobs", + "table_name": "deleted_jobs", "data": [ { - "id": 2, + "id": 1, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 1, "queue": null, "type": null, "state": null, "number": null, - "log": "", + "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", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, - "allow_failure": false, + "allow_failure": null, "owner_type": null, "owner_id": null, "result": null, @@ -28,7 +28,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 1, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -36,23 +36,23 @@ "priority": null }, { - "id": 3, + "id": 2, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 1, "queue": null, "type": null, "state": null, "number": null, - "log": "", + "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", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, - "allow_failure": false, + "allow_failure": null, "owner_type": null, "owner_id": null, "result": null, @@ -62,7 +62,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 1, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -70,23 +70,23 @@ "priority": null }, { - "id": 4, + "id": 5, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 5, "queue": null, "type": null, "state": null, "number": null, - "log": "", + "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", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, - "allow_failure": false, + "allow_failure": null, "owner_type": null, "owner_id": null, "result": null, @@ -96,7 +96,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 2, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -104,23 +104,23 @@ "priority": null }, { - "id": 5, + "id": 6, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 5, "queue": null, "type": null, "state": null, "number": null, - "log": "", + "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", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, - "allow_failure": false, + "allow_failure": null, "owner_type": null, "owner_id": null, "result": null, @@ -130,7 +130,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 2, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -138,23 +138,23 @@ "priority": null }, { - "id": 6, + "id": 9, "repository_id": null, "commit_id": null, - "source_type": "Build", - "source_id": 1, + "source_type": "Request", + "source_id": 7, "queue": null, "type": null, "state": null, "number": null, - "log": "", + "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", + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", "tags": null, - "allow_failure": false, + "allow_failure": null, "owner_type": null, "owner_id": null, "result": null, diff --git a/spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json similarity index 81% rename from spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json rename to spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json index 457ce18..6aa7cdb 100644 --- a/spec/support/expected_files/remove_repo_builds/deleted_job_15-15.json +++ b/spec/support/expected_files/remove_repo_requests/deleted_job_10-10.json @@ -2,11 +2,11 @@ "table_name": "deleted_jobs", "data": [ { - "id": 15, + "id": 10, "repository_id": null, "commit_id": null, - "source_type": "Build", - "source_id": 1, + "source_type": "Request", + "source_id": 7, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "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", + "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_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_1-7.json b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json new file mode 100644 index 0000000..8c013b0 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_1-7.json @@ -0,0 +1,45 @@ +{ + "table_name": "deleted_request_payloads", + "data": [ + { + "id": 1, + "request_id": 1, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 2, + "request_id": 1, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 5, + "request_id": 5, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 6, + "request_id": 5, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 7, + "request_id": 7, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000..f9e2163 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_payload_8-8.json @@ -0,0 +1,13 @@ +{ + "table_name": "deleted_request_payloads", + "data": [ + { + "id": 8, + "request_id": 7, + "payload": null, + "archived": null, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": 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_1-7.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_1-7.json new file mode 100644 index 0000000..9ec1b07 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_1-7.json @@ -0,0 +1,45 @@ +{ + "table_name": "deleted_request_raw_configurations", + "data": [ + { + "id": 1, + "request_id": 1, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 2, + "request_id": 1, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 5, + "request_id": 5, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 6, + "request_id": 5, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 7, + "request_id": 7, + "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_8-8.json b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_8-8.json new file mode 100644 index 0000000..56c1842 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/deleted_request_raw_configuration_8-8.json @@ -0,0 +1,13 @@ +{ + "table_name": "deleted_request_raw_configurations", + "data": [ + { + "id": 8, + "request_id": 7, + "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-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_builds/job_195-198.json b/spec/support/expected_files/remove_repo_requests/job_18-25.json similarity index 80% rename from spec/support/expected_files/remove_repo_builds/job_195-198.json rename to spec/support/expected_files/remove_repo_requests/job_18-25.json index 265f8aa..f8f3db9 100644 --- a/spec/support/expected_files/remove_repo_builds/job_195-198.json +++ b/spec/support/expected_files/remove_repo_requests/job_18-25.json @@ -2,11 +2,11 @@ "table_name": "jobs", "data": [ { - "id": 195, + "id": 18, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 5, "queue": null, "type": null, "state": null, @@ -15,8 +15,8 @@ "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", + "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, @@ -28,7 +28,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 43, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -36,11 +36,11 @@ "priority": null }, { - "id": 196, + "id": 22, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Build", + "source_id": 21, "queue": null, "type": null, "state": null, @@ -49,8 +49,8 @@ "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", + "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, @@ -62,7 +62,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 43, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -70,11 +70,11 @@ "priority": null }, { - "id": 197, + "id": 24, "repository_id": null, "commit_id": null, - "source_type": "Build", - "source_id": 192, + "source_type": "Request", + "source_id": 7, "queue": null, "type": null, "state": null, @@ -83,8 +83,8 @@ "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", + "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, @@ -104,11 +104,11 @@ "priority": null }, { - "id": 198, + "id": 25, "repository_id": null, "commit_id": null, - "source_type": "Build", - "source_id": 192, + "source_type": "Request", + "source_id": 7, "queue": null, "type": null, "state": null, @@ -117,8 +117,8 @@ "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", + "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_builds/job_7-181.json b/spec/support/expected_files/remove_repo_requests/job_2-17.json similarity index 81% rename from spec/support/expected_files/remove_repo_builds/job_7-181.json rename to spec/support/expected_files/remove_repo_requests/job_2-17.json index f488582..736879d 100644 --- a/spec/support/expected_files/remove_repo_builds/job_7-181.json +++ b/spec/support/expected_files/remove_repo_requests/job_2-17.json @@ -2,7 +2,7 @@ "table_name": "jobs", "data": [ { - "id": 7, + "id": 2, "repository_id": null, "commit_id": null, "source_type": "Build", @@ -15,8 +15,8 @@ "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", + "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, @@ -36,10 +36,10 @@ "priority": null }, { - "id": 8, + "id": 4, "repository_id": null, "commit_id": null, - "source_type": "Build", + "source_type": "Request", "source_id": 1, "queue": null, "type": null, @@ -49,8 +49,8 @@ "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", + "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, @@ -70,11 +70,11 @@ "priority": null }, { - "id": 179, + "id": 5, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 1, "queue": null, "type": null, "state": null, @@ -83,8 +83,8 @@ "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", + "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, @@ -96,7 +96,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 38, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -104,11 +104,11 @@ "priority": null }, { - "id": 180, + "id": 15, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Build", + "source_id": 14, "queue": null, "type": null, "state": null, @@ -117,8 +117,8 @@ "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", + "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, @@ -130,7 +130,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 38, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, @@ -138,11 +138,11 @@ "priority": null }, { - "id": 181, + "id": 17, "repository_id": null, "commit_id": null, - "source_type": null, - "source_id": null, + "source_type": "Request", + "source_id": 5, "queue": null, "type": null, "state": null, @@ -151,8 +151,8 @@ "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", + "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, @@ -164,7 +164,7 @@ "debug_options": null, "private": null, "stage_number": null, - "stage_id": 39, + "stage_id": null, "org_id": null, "com_id": null, "config_id": null, 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_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..501bebd 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:58:47 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:58:47 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:58:47 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:58:47 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:58:47 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..870d96b 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:58:47 UTC", "queued_at": null, "received_at": null, "started_at": null, 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_1-7.json b/spec/support/expected_files/remove_repo_requests/message_1-7.json new file mode 100644 index 0000000..e1d853a --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/message_1-7.json @@ -0,0 +1,75 @@ +{ + "table_name": "messages", + "data": [ + { + "id": 1, + "subject_id": 1, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 2, + "subject_id": 1, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 5, + "subject_id": 5, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 6, + "subject_id": 5, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "type": null, + "src": null, + "line": null + }, + { + "id": 7, + "subject_id": 7, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 UTC", + "type": null, + "src": null, + "line": null + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000..e071ebe --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/message_8-8.json @@ -0,0 +1,19 @@ +{ + "table_name": "messages", + "data": [ + { + "id": 8, + "subject_id": 7, + "subject_type": "Request", + "level": null, + "key": null, + "code": null, + "args": null, + "created_at": "2021-09-29 02:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 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-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_builds/nullified_relationships/build_2.json b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json similarity index 100% rename from spec/support/expected_files/remove_repo_builds/nullified_relationships/build_2.json rename to spec/support/expected_files/remove_repo_requests/nullified_relationships/build_2.json diff --git a/spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json b/spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json similarity index 100% rename from spec/support/expected_files/remove_repo_builds/nullified_relationships/build_1.json rename to spec/support/expected_files/remove_repo_requests/nullified_relationships/build_3.json 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-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_1-7.json similarity index 52% rename from spec/support/expected_files/remove_repo_requests/request_11-39.json rename to spec/support/expected_files/remove_repo_requests/request_1-7.json index 2c4f88b..ede8e2d 100644 --- a/spec/support/expected_files/remove_repo_requests/request_11-39.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-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08: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, @@ -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-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08: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, @@ -66,7 +66,7 @@ "pull_request_mergeable": null }, { - "id": 39, + "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-08-23 21:08:48 UTC", - "updated_at": "2021-08-23 21:08: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, @@ -92,10 +92,74 @@ "sender_id": null, "org_id": null, "com_id": null, - "config_id": null, + "config_id": 1, + "yaml_config_id": null, + "github_guid": null, + "pull_request_mergeable": null + }, + { + "id": 6, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "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, + "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": 7, + "repository_id": 1, + "commit_id": null, + "state": null, + "source": null, + "token": null, + "started_at": null, + "finished_at": null, + "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, + "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_8-8.json b/spec/support/expected_files/remove_repo_requests/request_8-8.json new file mode 100644 index 0000000..f5222aa --- /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:58:47 UTC", + "updated_at": "2021-09-29 02:58:47 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_config_1-1.json b/spec/support/expected_files/remove_repo_requests/request_config_1-1.json new file mode 100644 index 0000000..dc25495 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_config_1-1.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_configs", + "data": [ + { + "id": 1, + "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_1-7.json b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json new file mode 100644 index 0000000..637e5ae --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_payload_1-7.json @@ -0,0 +1,45 @@ +{ + "table_name": "request_payloads", + "data": [ + { + "id": 1, + "request_id": 1, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 2, + "request_id": 1, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 5, + "request_id": 5, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 6, + "request_id": 5, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + }, + { + "id": 7, + "request_id": 7, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": null + } + ] +} \ No newline at end of file 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 new file mode 100644 index 0000000..ab473ad --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_payload_8-8.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_payloads", + "data": [ + { + "id": 8, + "request_id": 7, + "payload": null, + "archived": false, + "created_at": "2021-09-29 02:58:47 UTC", + "org_id": 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_1-7.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_1-7.json new file mode 100644 index 0000000..c0fd82e --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_1-7.json @@ -0,0 +1,45 @@ +{ + "table_name": "request_raw_configurations", + "data": [ + { + "id": 1, + "request_id": 1, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 2, + "request_id": 1, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 5, + "request_id": 5, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 6, + "request_id": 5, + "request_raw_config_id": null, + "source": null, + "org_id": null, + "merge_mode": null + }, + { + "id": 7, + "request_id": 7, + "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_8-8.json b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_8-8.json new file mode 100644 index 0000000..c263ef5 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_raw_configuration_8-8.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_raw_configurations", + "data": [ + { + "id": 8, + "request_id": 7, + "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-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/request_yaml_config_1-1.json b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-1.json new file mode 100644 index 0000000..4dd2635 --- /dev/null +++ b/spec/support/expected_files/remove_repo_requests/request_yaml_config_1-1.json @@ -0,0 +1,13 @@ +{ + "table_name": "request_yaml_configs", + "data": [ + { + "id": 1, + "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_builds/stage_42-43.json b/spec/support/expected_files/remove_repo_requests/stage_1-5.json similarity index 57% rename from spec/support/expected_files/remove_repo_builds/stage_42-43.json rename to spec/support/expected_files/remove_repo_requests/stage_1-5.json index d68d03c..d7a9fa7 100644 --- a/spec/support/expected_files/remove_repo_builds/stage_42-43.json +++ b/spec/support/expected_files/remove_repo_requests/stage_1-5.json @@ -2,8 +2,8 @@ "table_name": "stages", "data": [ { - "id": 42, - "build_id": 192, + "id": 1, + "build_id": 1, "number": null, "name": null, "state": null, @@ -13,8 +13,19 @@ "com_id": null }, { - "id": 43, - "build_id": 192, + "id": 4, + "build_id": 14, + "number": null, + "name": null, + "state": null, + "started_at": null, + "finished_at": null, + "org_id": null, + "com_id": null + }, + { + "id": 5, + "build_id": 21, "number": null, "name": null, "state": null, 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/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 762defa..2ec3fd2 100644 --- a/spec/support/factories/repository.rb +++ b/spec/support/factories/repository.rb @@ -12,69 +12,15 @@ 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 - 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) @@ -83,7 +29,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 +38,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 +49,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 @@ -115,20 +61,67 @@ def create_for_repo(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(:build_for_removing_heavy_data, repository_id: repository.id) - last_build = create_for_repo(repository, :build_for_removing_heavy_data).last - create_for_repo(repository, :request) - create(:request, repository_id: repository.id) + after(:create) do |repository| + 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.update(last_build_id: last_build.id) + Model.record_timestamps = false + + # TODO + # repository.update(last_build_id: ) + + repository.request_configs.each do |config| + config.requests.each do |request| + request.update(repository_id: repository.id) + end + end + + # TODO + # 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 end + + repository.job_configs.each do |config| + config.jobs.each do |job| + job.update(repository_id: repository.id) + end + end + + repository.requests.each do |request| + request.builds.each do |build| + build.update(repository_id: repository.id) + end + end + + Model.record_timestamps = true end end @@ -140,7 +133,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) 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( 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")