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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/rails_lens/model_detector.rb +27 -2
- data/lib/rails_lens/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 792f89c06b8c11b77fb6892aa7488397d068104e2f30b7c343e38039660b0a2f
|
|
4
|
+
data.tar.gz: d808455520cffa29f877e43ca8492a1e6dae238e231c641fe8ddd36663ba3d07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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(
|
|
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(
|
|
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?
|
data/lib/rails_lens/version.rb
CHANGED