rails_error_dashboard 0.11.7 → 0.11.8

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: f55384ffa88ee1326e9575a6432eb392df3995395b8b4e821b5ec2576d34ab53
4
- data.tar.gz: a4166ab78f73a536986bb7b0c68c6ee95975db9769a611a69646900ca0d45d95
3
+ metadata.gz: d8f2e404fb451057a68a9210eaf1035282a061b1e9cdf1ad22f9831d6c85974a
4
+ data.tar.gz: cd2feb750eb08095785468bdaef7cc5968e197482f735f7b529d971029a12223
5
5
  SHA512:
6
- metadata.gz: 218881302d12e08887dc80dfcebd3d32b010d931dbec325c8f88317300f6c5006e88edab2d01e94d4ba8a12bc01daa0d19b94c9a787515b611ae980860ab4e0c
7
- data.tar.gz: 7d7ddd33b49891aa68ad8fa206465b4aa7f2f3a6ae1f2ae5e354a3f19f8b8ee6a68776a2662a14bbaedfb4029ccc15c5c479c0e2cd10d26869b2aff75021df45
6
+ metadata.gz: 5d320b2ab1fa0d4ff60f469d1cc895c52c78645c217a85baf776438b116fdac046b6c9c96645bfea7fb0d6874f0a139028613cecf9d5b7891ef8efa786323888
7
+ data.tar.gz: 82edc71f3850c9d75d8e40afdf9839ad79446537f4334c6c998acce167dcf7ffeccc4863b89f8165263cf4468ce9cba948d802eb9085fa3c6414d046095013a1
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The dashboard's PostgreSQL full-text search (Queries::ErrorsList#filter_by_search)
4
+ # matches against message, backtrace and error_type together:
5
+ #
6
+ # to_tsvector('english', COALESCE(message, '') || ' ' || COALESCE(backtrace, '') || ' ' || COALESCE(error_type, ''))
7
+ #
8
+ # PostgreSQL uses an expression index only when the query's expression is
9
+ # identical to the index's, so of the two GIN indexes defined over time only
10
+ # one can serve that search:
11
+ #
12
+ # index_error_logs_on_message_gin to_tsvector('english', message) never used by any query
13
+ # index_error_logs_on_searchable_text the expression above the one the search needs
14
+ #
15
+ # Which of them a host has depends on how it was installed. Hosts that ran the
16
+ # incremental chain got both; hosts installed from the squashed first migration
17
+ # got neither (the later index migrations skip themselves once the squash's
18
+ # composite indexes exist), and 0.11.7 then added only the message-only one.
19
+ #
20
+ # This converges every install on index_error_logs_on_searchable_text alone.
21
+ # No-op on other adapters.
22
+ class ReplaceMessageGinWithSearchableTextIndex < ActiveRecord::Migration[7.0]
23
+ TABLE = :rails_error_dashboard_error_logs
24
+
25
+ def up
26
+ return unless postgresql?
27
+ return unless table_exists?(TABLE)
28
+
29
+ execute <<~SQL
30
+ CREATE INDEX IF NOT EXISTS index_error_logs_on_searchable_text
31
+ ON rails_error_dashboard_error_logs
32
+ USING gin(to_tsvector('english',
33
+ COALESCE(message, '') || ' ' || COALESCE(backtrace, '') || ' ' || COALESCE(error_type, '')
34
+ ))
35
+ SQL
36
+
37
+ execute "DROP INDEX IF EXISTS index_error_logs_on_message_gin"
38
+ end
39
+
40
+ def down
41
+ return unless postgresql?
42
+
43
+ # There is no single state to return to: before this migration a host had
44
+ # either both indexes or only the message-only one, depending on its
45
+ # install path. Dropping searchable_text here would take away, on
46
+ # incremental-chain hosts, an index they had before, and nothing needs
47
+ # message_gin back. Earlier gem versions run unchanged against the
48
+ # converged schema.
49
+ raise ActiveRecord::IrreversibleMigration,
50
+ "this migration converges two index layouts (see its header); the previous layout is not recoverable"
51
+ end
52
+
53
+ private
54
+
55
+ def postgresql?
56
+ connection.adapter_name.downcase == "postgresql"
57
+ end
58
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsErrorDashboard
2
- VERSION = "0.11.7"
2
+ VERSION = "0.11.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_error_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.7
4
+ version: 0.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anjan Jagirdar
@@ -410,6 +410,7 @@ files:
410
410
  - db/migrate/20260826000001_add_environment_to_error_logs.rb
411
411
  - db/migrate/20260908000001_add_release_to_error_occurrences.rb
412
412
  - db/migrate/20260908220001_add_missing_postgresql_indexes_to_error_logs.rb
413
+ - db/migrate/20260909000001_replace_message_gin_with_searchable_text_index.rb
413
414
  - lib/generators/rails_error_dashboard/install/install_generator.rb
414
415
  - lib/generators/rails_error_dashboard/install/templates/README
415
416
  - lib/generators/rails_error_dashboard/install/templates/initializer.rb
@@ -578,7 +579,7 @@ metadata:
578
579
  funding_uri: https://github.com/sponsors/AnjanJ
579
580
  post_install_message: |
580
581
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
581
- RED (Rails Error Dashboard) v0.11.7
582
+ RED (Rails Error Dashboard) v0.11.8
582
583
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
583
584
 
584
585
  First install: