database_consistency 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4830aa2e788dbbee5e54ce2748509ef5b8bfab2c76e4355edcefff9ce04775de
4
- data.tar.gz: 26e284719ae0b7289164b34a6b0e9ccfaca84bbbd473451ec9114cd0fe57457b
3
+ metadata.gz: f88fd56f01f639d5614fa82f5e76f6d4a4dfb05c04c246f5baeedf93fd01fe24
4
+ data.tar.gz: 0bb41479e542c995569b54a6cfc188ea39103c30a074560f0bae15f8223c1128
5
5
  SHA512:
6
- metadata.gz: 8a6668676b8aca9c6e4dd55768c5c1c94b37c9de320ae38a535d8a69b49b164940a3ed7f5c2e12de24ccb208d7100863fa54cf715b879c99ca07850bb4565a46
7
- data.tar.gz: be80eee01a075040572372ddcba789ac392003f0dc269a491a810b7acbe05bfafd05c60702f0d2f7aed7785547c97fe1f27dbff25d4679aaeaa0af0cc1a44141
6
+ metadata.gz: 54baea922639aec00a1c1edb9aaef5e0d70ec91a2ce63552fcb2ab502b93c1a2779c3227fdb55c7cb03afd17a346624cfc192d84c07480583b44bba00554eea5
7
+ data.tar.gz: 69a60f5b359e2bfc89765756115e510646d6167fd2819da7f25451302c52f1f54c2c590e1a487eb2291c9e747a54e80bf4e193b9db506bc13f8cc7a580b0be8c
@@ -25,9 +25,10 @@ module DatabaseConsistency
25
25
  # We skip check when:
26
26
  # - Prism is not available (Ruby < 3.3)
27
27
  # - column is the primary key (always indexed)
28
+ # - column is a boolean (low-cardinality; single-column indexes are rarely useful)
28
29
  # - column name does not appear in any find_by call across project source files
29
30
  def preconditions
30
- defined?(Prism) && !primary_key_column? && find_by_used?
31
+ defined?(Prism) && !primary_key_column? && !boolean_column? && find_by_used?
31
32
  end
32
33
 
33
34
  # Table of possible statuses
@@ -73,6 +74,10 @@ module DatabaseConsistency
73
74
  column.name.to_s == model.primary_key.to_s
74
75
  end
75
76
 
77
+ def boolean_column?
78
+ column.type == :boolean
79
+ end
80
+
76
81
  if defined?(Prism)
77
82
  # Prism AST visitor that collects ALL find_by calls from a source file into a results hash.
78
83
  # Key: [model_name, column_name] -- model_name is derived from the explicit receiver or the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '3.0.4'
4
+ VERSION = '3.0.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-24 00:00:00.000000000 Z
11
+ date: 2026-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord