rails_error_dashboard 0.11.6 → 0.11.7

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: 31b48d634cb3ef3737bfc4744993cd315deec8555bc6a0a7da55d6a3e3b011d5
4
- data.tar.gz: 32fbeecb52dcbb0b48bf3f10f9fcc6da854ac20e0f1236a8fe0d37d1a3288475
3
+ metadata.gz: f55384ffa88ee1326e9575a6432eb392df3995395b8b4e821b5ec2576d34ab53
4
+ data.tar.gz: a4166ab78f73a536986bb7b0c68c6ee95975db9769a611a69646900ca0d45d95
5
5
  SHA512:
6
- metadata.gz: 76346c5b3c5b5ba64e272d27024dc29a4635eca2024458a10b1eff9b0a842dd5cb96bbd671566d59ce3b53f44d5ca7d61250f4f620f6b4e0e4212f09d2c884d4
7
- data.tar.gz: e9fcc3afb33b3d550c830453e1d8e1325081e6f182103975855dc337c56ea1735fbfccc3879b8af35cb1fdb119eb925ccff5b516108a2eb9d3eb300ff5094e8f
6
+ metadata.gz: 218881302d12e08887dc80dfcebd3d32b010d931dbec325c8f88317300f6c5006e88edab2d01e94d4ba8a12bc01daa0d19b94c9a787515b611ae980860ab4e0c
7
+ data.tar.gz: 7d7ddd33b49891aa68ad8fa206465b4aa7f2f3a6ae1f2ae5e354a3f19f8b8ee6a68776a2662a14bbaedfb4029ccc15c5c479c0e2cd10d26869b2aff75021df45
@@ -38,6 +38,13 @@ class FixSwallowedExceptionsIndexForMysql < ActiveRecord::Migration[7.0]
38
38
 
39
39
  def down
40
40
  return unless table_exists?(:rails_error_dashboard_swallowed_exceptions)
41
+ # The pre-migration shape (500-char locations under a five-column unique
42
+ # index) is exactly what MySQL cannot create — that is why this migration
43
+ # exists — so there is nothing valid to roll back to there.
44
+ if connection.adapter_name.match?(/mysql|trilogy/i)
45
+ raise ActiveRecord::IrreversibleMigration,
46
+ "the previous swallowed_exceptions index exceeds MySQL's 3072-byte key limit; this migration cannot be reversed on MySQL"
47
+ end
41
48
 
42
49
  if index_name_exists?(:rails_error_dashboard_swallowed_exceptions, "index_swallowed_exceptions_upsert_key")
43
50
  remove_index :rails_error_dashboard_swallowed_exceptions, name: "index_swallowed_exceptions_upsert_key"
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Fresh PostgreSQL installs never got two indexes the query layer was written
4
+ # for: 20251225071314_add_optimized_indexes_to_error_logs returns early once
5
+ # its composite indexes exist, and the squashed first migration creates those
6
+ # composites but not the PostgreSQL-only partial index on unresolved rows or
7
+ # the GIN index behind full-text message search. Existing installs that ran
8
+ # the incremental chain have them; this adds them wherever they are missing.
9
+ # No-op on other adapters.
10
+ class AddMissingPostgresqlIndexesToErrorLogs < ActiveRecord::Migration[7.0]
11
+ TABLE = :rails_error_dashboard_error_logs
12
+
13
+ def up
14
+ return unless postgresql?
15
+ return unless table_exists?(TABLE)
16
+
17
+ unless index_name_exists?(TABLE, "index_error_logs_on_occurred_at_unresolved")
18
+ add_index TABLE, :occurred_at, where: "resolved = false",
19
+ name: "index_error_logs_on_occurred_at_unresolved"
20
+ end
21
+
22
+ execute <<-SQL
23
+ CREATE INDEX IF NOT EXISTS index_error_logs_on_message_gin
24
+ ON rails_error_dashboard_error_logs
25
+ USING gin(to_tsvector('english', message))
26
+ SQL
27
+ end
28
+
29
+ def down
30
+ return unless postgresql?
31
+ return unless table_exists?(TABLE)
32
+
33
+ remove_index TABLE, name: "index_error_logs_on_occurred_at_unresolved", if_exists: true
34
+ execute "DROP INDEX IF EXISTS index_error_logs_on_message_gin"
35
+ end
36
+
37
+ private
38
+
39
+ def postgresql?
40
+ connection.adapter_name.downcase == "postgresql"
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsErrorDashboard
2
- VERSION = "0.11.6"
2
+ VERSION = "0.11.7"
3
3
  end
@@ -52,6 +52,30 @@ namespace :error_dashboard do
52
52
  checks_failed += 1
53
53
  end
54
54
 
55
+ # 3b. MySQL only: named-zone conversion needs the server's time zone
56
+ # tables; without them groupdate (charts, baselines) raises.
57
+ begin
58
+ conn = RailsErrorDashboard::ErrorLogsRecord.connection
59
+ if conn.adapter_name.match?(/mysql|trilogy/i)
60
+ print " MySQL time zone tables... "
61
+ zone = (Time.zone || ActiveSupport::TimeZone["UTC"]).tzinfo.name
62
+ converted = conn.select_value("SELECT CONVERT_TZ(NOW(), '+00:00', #{conn.quote(zone)})")
63
+ if converted.nil?
64
+ puts "MISSING"
65
+ puts " CONVERT_TZ to '#{zone}' returned NULL: the server has no time zone tables,"
66
+ puts " so the dashboard's time-bucketed charts and baselines will raise."
67
+ puts " Fix (on the MySQL server): mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql"
68
+ puts " See docs/guides/DATABASE_OPTIONS.md (MySQL)."
69
+ warnings += 1
70
+ else
71
+ puts "OK (#{zone})"
72
+ checks_passed += 1
73
+ end
74
+ end
75
+ rescue => e
76
+ puts "SKIPPED (#{e.message.truncate(60)})"
77
+ end
78
+
55
79
  # 4. Tables check
56
80
  print " Required tables... "
57
81
  required_tables = %w[
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.6
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anjan Jagirdar
@@ -409,6 +409,7 @@ files:
409
409
  - db/migrate/20260824000001_add_user_agent_to_rack_attack_events.rb
410
410
  - db/migrate/20260826000001_add_environment_to_error_logs.rb
411
411
  - db/migrate/20260908000001_add_release_to_error_occurrences.rb
412
+ - db/migrate/20260908220001_add_missing_postgresql_indexes_to_error_logs.rb
412
413
  - lib/generators/rails_error_dashboard/install/install_generator.rb
413
414
  - lib/generators/rails_error_dashboard/install/templates/README
414
415
  - lib/generators/rails_error_dashboard/install/templates/initializer.rb
@@ -577,7 +578,7 @@ metadata:
577
578
  funding_uri: https://github.com/sponsors/AnjanJ
578
579
  post_install_message: |
579
580
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
580
- RED (Rails Error Dashboard) v0.11.6
581
+ RED (Rails Error Dashboard) v0.11.7
581
582
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
582
583
 
583
584
  First install: