rails_error_dashboard 0.14.1 → 0.14.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.
@@ -16,75 +16,69 @@ namespace :rails_error_dashboard do
16
16
  puts "=" * 80
17
17
  puts "\n"
18
18
 
19
- # List tables that will be dropped
20
- tables_to_drop = [
21
- "rails_error_dashboard_error_comments",
22
- "rails_error_dashboard_error_occurrences",
23
- "rails_error_dashboard_cascade_patterns",
24
- "rails_error_dashboard_error_baselines",
25
- "rails_error_dashboard_error_logs"
26
- ]
19
+ # The connection RED's models use: the separate or shared error database
20
+ # when there is one. Raises if the engine fell back to the primary one.
21
+ connection = RailsErrorDashboard::Commands::DropAllTables.connection
22
+ database = connection.pool.db_config.name
23
+ plan = RailsErrorDashboard::Queries::UninstallPlan.call(connection)
27
24
 
28
- existing_tables = tables_to_drop.select do |table|
29
- ActiveRecord::Base.connection.table_exists?(table)
30
- end
31
-
32
- if existing_tables.empty?
33
- puts "No Rails Error Dashboard tables found in the database."
25
+ if plan.empty?
26
+ puts "No Rails Error Dashboard tables found in the '#{database}' database."
34
27
  puts "\n"
35
- exit 0
28
+ next
36
29
  end
37
30
 
38
- puts "The following tables will be PERMANENTLY DELETED:"
39
- existing_tables.each do |table|
40
- record_count = ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM #{table}").first.values.first rescue 0
41
- puts " • #{table} (#{record_count} records)"
31
+ puts "The following tables in the '#{database}' database will be PERMANENTLY DELETED:"
32
+ plan.each do |entry|
33
+ puts " • #{entry[:table]} (#{entry[:rows] || '?'} records)"
42
34
  end
43
35
  puts "\n"
36
+
37
+ if plan.any? { |entry| entry[:table] == "rails_error_dashboard_applications" }
38
+ names = connection.select_values("SELECT name FROM #{connection.quote_table_name('rails_error_dashboard_applications')} ORDER BY name")
39
+ if names.size > 1
40
+ puts "⚠️ This database holds errors for #{names.size} applications, and ALL of them will be deleted:"
41
+ names.each { |name| puts " • #{name}" }
42
+ puts "\n"
43
+ end
44
+ end
45
+
44
46
  puts "⚠️ This action CANNOT be undone!"
45
47
  puts "\n"
46
48
 
47
- # Ask for confirmation
48
49
  print "Type 'DELETE ALL DATA' to confirm: "
49
- confirmation = $stdin.gets.chomp
50
+ confirmation = $stdin.gets.to_s.chomp
50
51
 
51
52
  if confirmation != "DELETE ALL DATA"
52
53
  puts "\n"
53
54
  puts "Cancelled. No tables were dropped."
54
55
  puts "\n"
55
- exit 0
56
+ next
56
57
  end
57
58
 
58
59
  puts "\n"
59
60
  puts "Dropping tables..."
60
-
61
- # Drop tables in reverse order (respects foreign keys)
62
- dropped_count = 0
63
- existing_tables.reverse.each do |table|
64
- begin
65
- ActiveRecord::Base.connection.drop_table(table, if_exists: true)
66
- puts " ✓ Dropped #{table}"
67
- dropped_count += 1
68
- rescue => e
69
- puts " ✗ Failed to drop #{table}: #{e.message}"
70
- end
71
- end
61
+ dropped = RailsErrorDashboard::Commands::DropAllTables.call(connection: connection)
62
+ dropped.each { |table| puts " ✓ Dropped #{table}" }
72
63
 
73
64
  puts "\n"
74
65
  puts "=" * 80
75
- puts " ✅ Successfully dropped #{dropped_count} table(s)"
66
+ puts " ✅ Successfully dropped #{dropped.size} table(s)"
76
67
  puts "=" * 80
77
68
  puts "\n"
78
69
  puts "Next steps:"
79
- puts " 1. Remove gem 'rails_error_dashboard' from Gemfile"
80
- puts " 2. Run: bundle install"
81
- puts " 3. Remove initializer: config/initializers/rails_error_dashboard.rb"
82
- puts " 4. Remove route from config/routes.rb"
83
- puts " 5. Delete migration files: db/migrate/*rails_error_dashboard*.rb"
84
- puts " 6. Restart your Rails server"
70
+ puts " 1. Remove the initializer: config/initializers/rails_error_dashboard.rb"
71
+ puts " 2. Remove the route from config/routes.rb (mount RailsErrorDashboard::Engine)"
72
+ puts " 3. Delete RED's migrations: db/migrate/*rails_error_dashboard*.rb"
73
+ puts " (and db/error_dashboard_migrate/ with a separate database)"
74
+ puts " 4. Separate database: remove its entry from config/database.yml"
75
+ puts " 5. Regenerate the schema file: bin/rails db:schema:dump"
76
+ puts " (otherwise db:schema:load recreates these tables)"
77
+ puts " 6. Remove gem 'rails_error_dashboard' from the Gemfile and run: bundle install"
78
+ puts " 7. Restart your Rails server"
85
79
  puts "\n"
86
- puts "Or use the automated uninstaller:"
87
- puts " rails generate rails_error_dashboard:uninstall"
80
+ puts "Or use the automated uninstaller, before removing the gem:"
81
+ puts " bin/rails generate rails_error_dashboard:uninstall"
88
82
  puts "\n"
89
83
  end
90
84
  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.14.1
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anjan Jagirdar
@@ -429,7 +429,6 @@ files:
429
429
  - lib/generators/rails_error_dashboard/install/templates/README
430
430
  - lib/generators/rails_error_dashboard/install/templates/initializer.rb
431
431
  - lib/generators/rails_error_dashboard/solid_queue/solid_queue_generator.rb
432
- - lib/generators/rails_error_dashboard/solid_queue/templates/queue.yml
433
432
  - lib/generators/rails_error_dashboard/uninstall/uninstall_generator.rb
434
433
  - lib/rails_error_dashboard.rb
435
434
  - lib/rails_error_dashboard/commands/add_error_comment.rb
@@ -442,6 +441,7 @@ files:
442
441
  - lib/rails_error_dashboard/commands/batch_unmute_errors.rb
443
442
  - lib/rails_error_dashboard/commands/calculate_cascade_probability.rb
444
443
  - lib/rails_error_dashboard/commands/create_issue.rb
444
+ - lib/rails_error_dashboard/commands/drop_all_tables.rb
445
445
  - lib/rails_error_dashboard/commands/find_or_create_application.rb
446
446
  - lib/rails_error_dashboard/commands/find_or_increment_error.rb
447
447
  - lib/rails_error_dashboard/commands/flush_rack_attack_events.rb
@@ -508,6 +508,7 @@ files:
508
508
  - lib/rails_error_dashboard/queries/similar_errors.rb
509
509
  - lib/rails_error_dashboard/queries/storm_history.rb
510
510
  - lib/rails_error_dashboard/queries/swallowed_exception_summary.rb
511
+ - lib/rails_error_dashboard/queries/uninstall_plan.rb
511
512
  - lib/rails_error_dashboard/queries/user_impact_summary.rb
512
513
  - lib/rails_error_dashboard/services/ai_agent_classifier.rb
513
514
  - lib/rails_error_dashboard/services/analytics_cache_manager.rb
@@ -563,6 +564,7 @@ files:
563
564
  - lib/rails_error_dashboard/services/severity_classifier.rb
564
565
  - lib/rails_error_dashboard/services/similarity_calculator.rb
565
566
  - lib/rails_error_dashboard/services/slack_payload_builder.rb
567
+ - lib/rails_error_dashboard/services/solid_queue_config_check.rb
566
568
  - lib/rails_error_dashboard/services/source_code_reader.rb
567
569
  - lib/rails_error_dashboard/services/statistical_classifier.rb
568
570
  - lib/rails_error_dashboard/services/storm_protection/circuit_breaker.rb
@@ -599,7 +601,7 @@ metadata:
599
601
  funding_uri: https://github.com/sponsors/AnjanJ
600
602
  post_install_message: |
601
603
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
602
- RED (Rails Error Dashboard) v0.14.1
604
+ RED (Rails Error Dashboard) v0.14.3
603
605
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
604
606
 
605
607
  First install:
@@ -1,55 +0,0 @@
1
- # Solid Queue configuration for RailsErrorDashboard
2
- #
3
- # This file configures workers for error logging and notifications.
4
- # Adjust threads and processes based on your application's needs.
5
-
6
- # Development environment - optimized for low resource usage
7
- development:
8
- workers:
9
- # Error notifications (Slack, Email, Discord, PagerDuty, Webhooks)
10
- - queues: error_notifications
11
- threads: 2
12
- processes: 1
13
- polling_interval: 1
14
-
15
- # Default queue (includes async error logging)
16
- - queues: default
17
- threads: 3
18
- processes: 1
19
- polling_interval: 1
20
-
21
- # Test environment - minimal configuration
22
- test:
23
- workers:
24
- - queues: "*"
25
- threads: 1
26
- processes: 1
27
- polling_interval: 0.1
28
-
29
- # Production environment - optimized for throughput
30
- production:
31
- workers:
32
- # Error notifications - lower concurrency (external API calls)
33
- - queues: error_notifications
34
- threads: 3
35
- processes: 1
36
- polling_interval: 0.5
37
-
38
- # Default queue - higher concurrency (database operations)
39
- - queues: default
40
- threads: 5
41
- processes: 2
42
- polling_interval: 0.5
43
-
44
- # Staging environment - similar to production but scaled down
45
- staging:
46
- workers:
47
- - queues: error_notifications
48
- threads: 2
49
- processes: 1
50
- polling_interval: 0.5
51
-
52
- - queues: default
53
- threads: 3
54
- processes: 1
55
- polling_interval: 0.5