Sha256: 7eac0eb085d3beeb1b2813fb3633a0d123cd3de5d2db01f56adc351d5d8e487e

Contents?: true

Size: 1.6 KB

Versions: 12

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

module Neetob
  class CLI
    module MonthlyAudit
      module Databases
        class UuidPrimaryKey < CLI::Base
          def initialize
            super()
          end

          def run
            repo_data = [[
              "Repository",
              "All tables have UUID primary keys",
              "Comments",
              "Audit Passed"
              ]
            ]
            NeetoCompliance::NeetoRepos.products.keys.each do |repo|
              ui.info "Checking #{repo}...", print_to_audit_log: false
              code_audit_result = Neetob::CLI::Code::Audit.new([repo]).run[0]
              if code_audit_result[:error]
                repo_data << [repo, nil, code_audit_result[:error], "No"]
                next
              end
              tables_without_uuid = code_audit_result[:tables_without_uuid]
              tables_without_uuid.reject! { |table|
                table == "data_migrations" ||
                table == "server_side_sessions" ||
                table.include?("solid_queue") ||
                table.include?("active_storage")
              }
              all_tables_have_uuid_primary_keys = tables_without_uuid.empty? ? "Yes" : "No"
              audit_passed = all_tables_have_uuid_primary_keys == "Yes" ? "Yes" : "No"
              comments = tables_without_uuid.empty? ? nil : "Tables without UUID primary keys: #{tables_without_uuid.join(', ')}"
              repo_data << [repo, all_tables_have_uuid_primary_keys, comments, audit_passed]
            end
            ui.print_table(repo_data)
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
neetob-0.5.28 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.27 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.26 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.25 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.24 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.23 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.22 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.21 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.20 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.19 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.18 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb
neetob-0.5.17 lib/neetob/cli/monthly_audit/databases/uuid_primary_key.rb