rails_lens 0.5.2 → 0.5.3

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: 5180524144ca10c72173e0410e924877e7de878379a7924a0931adba19be185b
4
- data.tar.gz: 4b76f310866feb24bb206b9004a4091c78553c147e9e0114131a693eb1d78097
3
+ metadata.gz: 792f89c06b8c11b77fb6892aa7488397d068104e2f30b7c343e38039660b0a2f
4
+ data.tar.gz: d808455520cffa29f877e43ca8492a1e6dae238e231c641fe8ddd36663ba3d07
5
5
  SHA512:
6
- metadata.gz: 655c2c927177454346c7b0dae09c4faaed881e2df93941c27a29511ba2c48dd5e42742f426036c0187f60bfa631ec60941e0e00de8b26b91012ef6e6a4727a9f
7
- data.tar.gz: b7d9465fdb5daa3ed000dbca03c673a39fc8c7141ccebeb3d7c050d478358b99ba25a95c1f425365472d75c1ed06cf1cc4e332f78e0015a1bd289bf8eb5beff9
6
+ metadata.gz: a754d8353f7a75e11283af18fb2c128bdedec40bf673b5c2cae042d48c14d98dd3c7f26c118d81e0af09a836e0624a4ad2dbd5d092b7b64e4c8664aa9540df0f
7
+ data.tar.gz: 821f26b9307bfd92914e9c1e6266c3bad0db90c16593e98eb91c1878f9662b3409485a0f32d03d8a007fd1d73bb9f114faec367ce533c41699f01cc2b0b12dc9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.3](https://github.com/seuros/rails_lens/compare/rails_lens/v0.5.2...rails_lens/v0.5.3) (2026-02-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * handle edge cases table naming. ([dec95af](https://github.com/seuros/rails_lens/commit/dec95af7866a9ed3c5430974a1492749ca0a5f8e))
9
+
3
10
  ## [0.5.2](https://github.com/seuros/rails_lens/compare/rails_lens/v0.5.1...rails_lens/v0.5.2) (2026-02-16)
4
11
 
5
12
 
@@ -78,13 +78,38 @@ module RailsLens
78
78
 
79
79
  # rubocop:disable Naming/PredicateMethod
80
80
  def check_postgresql_view(connection, table_name)
81
+ # Handle schema-qualified table names (e.g., 'audit.audit_logs')
82
+ if table_name.include?('.')
83
+ schema_name, unqualified_name = table_name.split('.', 2)
84
+ schema_filter = "'#{connection.quote_string(schema_name)}'"
85
+ table_to_check = unqualified_name
86
+ else
87
+ # Extract search_path schemas for unqualified table names
88
+ search_path = connection.schema_search_path
89
+ .split(',')
90
+ .map(&:strip)
91
+ .reject { |s| s == '"$user"' || s.empty? }
92
+
93
+ # Default to 'public' if search_path is empty
94
+ search_path = ['public'] if search_path.empty?
95
+
96
+ schema_filter = search_path.map { |s| "'#{connection.quote_string(s)}'" }.join(', ')
97
+ table_to_check = table_name
98
+ end
99
+
81
100
  # Check both regular views and materialized views
101
+ # Exclude system schemas to prevent false positives when user table names
102
+ # match PostgreSQL system view names (e.g., 'triggers', 'tables', 'columns')
82
103
  result = connection.exec_query(<<~SQL.squish, 'Check PostgreSQL View')
83
104
  SELECT 1 FROM information_schema.views
84
- WHERE table_name = '#{connection.quote_string(table_name)}'
105
+ WHERE table_name = '#{connection.quote_string(table_to_check)}'
106
+ AND table_schema IN (#{schema_filter})
107
+ AND table_schema NOT IN ('information_schema', 'pg_catalog', 'pg_toast')
85
108
  UNION ALL
86
109
  SELECT 1 FROM pg_matviews
87
- WHERE matviewname = '#{connection.quote_string(table_name)}'
110
+ WHERE matviewname = '#{connection.quote_string(table_to_check)}'
111
+ AND schemaname IN (#{schema_filter})
112
+ AND schemaname NOT IN ('information_schema', 'pg_catalog', 'pg_toast')
88
113
  LIMIT 1
89
114
  SQL
90
115
  result.rows.any?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsLens
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_lens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih