rails-pg-extras 5.6.1 → 5.6.4
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/README.md +1 -1
- data/app/views/layouts/rails_pg_extras/web/application.html.erb +1 -1
- data/app/views/rails_pg_extras/web/queries/_diagnose.html.erb +24 -7
- data/app/views/rails_pg_extras/web/queries/_result.html.erb +22 -19
- data/app/views/rails_pg_extras/web/queries/index.html.erb +2 -0
- data/app/views/rails_pg_extras/web/queries/show.html.erb +17 -11
- data/app/views/rails_pg_extras/web/shared/_queries_selector.html.erb +4 -4
- data/lib/rails_pg_extras/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c64f0e93ed959cd497aa7bfd471eb4dcf5e8327e31d46891d68f436ef63a9be6
|
4
|
+
data.tar.gz: 88778283a0b42e9a697dae56229e048ad35f657b7db58caed44f5b244cca4205
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: facfda5f88e9dd06f9ec11229bb40e399879d2c92f02b6eaa45d60bb853ddd9d768bc551881de9115386d3b5eb28ea5cbb3d6ca59e42cfda8f3cddb8e18de3d4
|
7
|
+
data.tar.gz: 859539a5d63c299acf366c799faacaf433f300c7737935fab678f48a4d2981c383954b5972f3ba921373fd2c0a8890ec027e2769012343d7f81fbfca1b1b0623
|
data/README.md
CHANGED
@@ -212,7 +212,7 @@ you can add this info to the output:
|
|
212
212
|
|
213
213
|
### `missing_fk_indexes`
|
214
214
|
|
215
|
-
This method lists columns likely to be foreign keys (i.e. column name ending in `_id` and related table exists)
|
215
|
+
This method lists columns likely to be foreign keys (i.e. column name ending in `_id` and related table exists) which don't have an index. It's recommended to always index foreign key columns because they are used for searching relation objects.
|
216
216
|
|
217
217
|
You can add indexes on the columns returned by this query and later check if they are receiving scans using the [unused_indexes method](#unused_indexes). Please remember that each index decreases write performance and autovacuuming overhead, so be careful when adding multiple indexes to often updated tables.
|
218
218
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<link href="/pg-extras-tailwind.min.css" rel="stylesheet">
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
</head>
|
9
|
-
<body class="p-5 text-
|
9
|
+
<body class="p-5 text-sm">
|
10
10
|
<% if flash[:notice] %>
|
11
11
|
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-4" role="alert">
|
12
12
|
<p class="font-bold">Notice</p>
|
@@ -1,9 +1,26 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<h1 class="font-bold text-2xl my-6 text-gray-900">Diagnose
|
2
|
+
<span class='pg-extras-help'>
|
3
|
+
(<a href="https://pawelurbanek.com/postgresql-fix-performance"
|
4
|
+
class="text-blue-600 hover:text-blue-800 hover:underline" target='_blank'>Tutorial</a>)
|
5
|
+
</span>
|
6
|
+
</h1>
|
7
|
+
<div class="overflow-x-auto">
|
8
|
+
<table class="w-full border border-gray-400 shadow-md rounded-lg overflow-hidden">
|
9
|
+
<thead>
|
10
|
+
<tr class="bg-gray-200 text-gray-900 text-left uppercase text-sm font-bold">
|
11
|
+
<th class="px-4 py-3 border">Ok</th>
|
12
|
+
<th class="px-4 py-3 border">Check Name</th>
|
13
|
+
<th class="px-4 py-3 border">Message</th>
|
7
14
|
</tr>
|
8
|
-
|
15
|
+
</thead>
|
16
|
+
<tbody>
|
17
|
+
<% RailsPgExtras.diagnose(in_format: :hash).each do |diagnosis| %>
|
18
|
+
<tr class="<%= diagnosis[:ok] ? "bg-green-100 text-green-900" : "bg-red-100 text-red-900" %> hover:bg-gray-300 transition">
|
19
|
+
<td class="px-4 py-3 border font-bold"><%= diagnosis[:ok] ? "YES" : "NO" %></td>
|
20
|
+
<td class="px-4 py-3 border font-semibold"><%= diagnosis[:check_name] %></td>
|
21
|
+
<td class="px-4 py-3 border"><%= diagnosis[:message] %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
9
25
|
</table>
|
26
|
+
</div>
|
@@ -1,21 +1,24 @@
|
|
1
|
-
<h1 class="font-bold text-
|
1
|
+
<h1 class="font-bold text-2xl my-6 text-gray-800"><%= title %></h1>
|
2
2
|
|
3
|
-
<
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
3
|
+
<div class="overflow-x-auto bg-white shadow-md rounded-lg">
|
4
|
+
<table class="w-full border border-gray-300 rounded-lg overflow-hidden">
|
5
|
+
<thead>
|
6
|
+
<tr class="bg-gray-100 text-gray-700 text-left uppercase text-sm font-semibold">
|
7
|
+
<% headers.each do |header| %>
|
8
|
+
<th class="px-4 py-3 border"><%= header %></th>
|
9
|
+
<% end %>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% rows.each.with_index do |row, i| %>
|
14
|
+
<tr class="transition hover:bg-blue-100 hover:text-white <%= i.even? ? "bg-gray-50" : "bg-gray-100" %>">
|
15
|
+
<% row.each do |column| %>
|
16
|
+
<td class="px-4 py-3 border text-gray-800"><%= column %></td>
|
17
|
+
<% end %>
|
18
|
+
</tr>
|
8
19
|
<% end %>
|
9
|
-
</
|
10
|
-
</
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<% row.each do |column| %>
|
15
|
-
<td class="p-1 border"><%= column %></td>
|
16
|
-
<% end %>
|
17
|
-
</tr>
|
18
|
-
<% end %>
|
19
|
-
</tbody>
|
20
|
-
</table>
|
21
|
-
<span class="italic">run_at: <%= Time.now.utc %></span>
|
20
|
+
</tbody>
|
21
|
+
</table>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<p class="italic text-gray-500 text-sm mt-3">Run at: <%= Time.now.utc %></p>
|
@@ -1,8 +1,14 @@
|
|
1
1
|
<%= content_for :title, params[:query_name].presence || "pg_extras" %>
|
2
2
|
<%= render "rails_pg_extras/web/shared/queries_selector" %>
|
3
|
-
|
3
|
+
|
4
|
+
<br>
|
5
|
+
|
6
|
+
<a href="/pg_extras/queries"
|
7
|
+
class="inline-block bg-blue-500 text-white font-medium px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition">
|
8
|
+
← Back to Diagnose
|
9
|
+
</a>
|
4
10
|
<% if @error %>
|
5
|
-
<div class="text-red-500 p-3 font-mono my-5"><%= @error %></div>
|
11
|
+
<div class="text-red-500 p-3 font-mono my-5"><%= @error %></div>
|
6
12
|
<% else %>
|
7
13
|
<% if @result&.any? %>
|
8
14
|
<%= render "result",
|
@@ -10,14 +16,14 @@
|
|
10
16
|
headers: @result[0].keys,
|
11
17
|
rows: @result.values %>
|
12
18
|
<% else %>
|
13
|
-
<div class="font-mono p-3 bg-gray-100 mt-3">No results</div>
|
19
|
+
<div class="font-mono p-3 bg-gray-100 mt-3">No results</div>
|
14
20
|
<% end %>
|
15
21
|
<% end %>
|
16
|
-
|
17
|
-
<style>
|
18
|
-
@media print {
|
19
|
-
form {
|
20
|
-
display: none
|
21
|
-
}
|
22
|
-
}
|
23
|
-
</style>
|
22
|
+
|
23
|
+
<style>
|
24
|
+
@media print {
|
25
|
+
form {
|
26
|
+
display: none
|
27
|
+
}
|
28
|
+
}
|
29
|
+
</style>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<%= form_tag queries_path, id: "queries", method: :get do |f| %>
|
2
|
-
<%= select_tag :query_name, options_for_select(@all_queries, params[:query_name]),
|
3
|
-
{ prompt: "
|
4
|
-
<% end %>
|
1
|
+
<%= form_tag queries_path, id: "queries", method: :get do |f| %>
|
2
|
+
<%= select_tag :query_name, options_for_select(@all_queries, params[:query_name]),
|
3
|
+
{ prompt: "diagnose", class: "border p-2 font-bold", autofocus: true } %>
|
4
|
+
<% end %>
|
5
5
|
|
6
6
|
<%= javascript_tag nonce: true do -%>
|
7
7
|
document.getElementById('queries').addEventListener('change', (e) => {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.6.
|
4
|
+
version: 5.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-pg-extras
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.6.
|
19
|
+
version: 5.6.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.6.
|
26
|
+
version: 5.6.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|