You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

database_consistency

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

database_consistency - rubygems Package Compare versions

Comparing version
2.0.5
to
2.0.6
+7
-2
lib/database_consi...ciation_checkers/foreign_key_checker.rb

@@ -45,4 +45,9 @@ # frozen_string_literal: true

# | missing | fail |
def check
if model.connection.foreign_keys(model.table_name).find { |fk| fk.column == association.foreign_key.to_s }
def check # rubocop:disable Metrics/AbcSize
fk_exist = model.connection.foreign_keys(model.table_name).any? do |fk|
(Helper.extract_columns(association.foreign_key.to_s) - Array.wrap(fk.column)).empty? &&
fk.to_table == association.klass.table_name
end
if fk_exist
report_template(:ok)

@@ -49,0 +54,0 @@ else

@@ -115,2 +115,6 @@ # frozen_string_literal: true

def extract_columns(str)
str.scan(/(\w+)/).flatten
end
def foreign_key_or_attribute(model, attribute)

@@ -117,0 +121,0 @@ model._reflect_on_association(attribute)&.foreign_key || attribute

# frozen_string_literal: true
module DatabaseConsistency
VERSION = '2.0.5'
VERSION = '2.0.6'
end