diff --git a/Gemfile b/Gemfile index af113a0..50da96b 100644 --- a/Gemfile +++ b/Gemfile @@ -108,3 +108,5 @@ gem "rouge", "~> 4.2" # analytics gem "ahoy_matey" gem "blazer" + +gem "solid_errors", "~> 0.3.3" diff --git a/Gemfile.lock b/Gemfile.lock index 1ba3213..c503544 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -454,6 +454,8 @@ GEM sitepress-core (= 4.0.2) sprockets-rails (>= 2.0.0) smart_properties (1.17.0) + solid_errors (0.3.3) + rails (~> 7.0) sorbet-runtime (0.5.11200) sprockets (4.2.1) concurrent-ruby (~> 1.0) @@ -568,6 +570,7 @@ DEPENDENCIES ruby-lsp-rails selenium-webdriver sitepress-rails (~> 4.0) + solid_errors (~> 0.3.3) sqlite3 (~> 1.4) standardrb (~> 1.0) stimulus-rails diff --git a/config/routes.rb b/config/routes.rb index 9278870..c0ede42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,6 +19,7 @@ authenticate :admin do mount Avo::Engine, at: Avo.configuration.root_path mount Blazer::Engine, at: "blazer" + mount SolidErrors::Engine, at: "/solid_errors" end # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html diff --git a/db/migrate/20240128210010_create_solid_errors_tables.rb b/db/migrate/20240128210010_create_solid_errors_tables.rb new file mode 100644 index 0000000..5719e9c --- /dev/null +++ b/db/migrate/20240128210010_create_solid_errors_tables.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateSolidErrorsTables < ActiveRecord::Migration[7.1] + def change + create_table :solid_errors do |t| + t.string :exception_class, null: false + t.string :message, null: false + t.string :severity, null: false + t.string :source + t.datetime :resolved_at, index: true + + t.timestamps + + t.index [:exception_class, :message, :severity, :source], unique: true, name: "solid_error_uniqueness_index" + end + + create_table :solid_errors_occurrences do |t| + t.belongs_to :error, null: false, foreign_key: {to_table: :solid_errors} + t.text :backtrace + t.json :context + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 9c7c875..b6d04c0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_22_061850) do +ActiveRecord::Schema[7.1].define(version: 2024_01_28_210010) do create_table "ahoy_events", force: :cascade do |t| t.integer "visit_id" t.integer "user_id" @@ -118,6 +118,27 @@ t.index ["user_id"], name: "index_sessions_on_user_id" end + create_table "solid_errors", force: :cascade do |t| + t.string "exception_class", null: false + t.string "message", null: false + t.string "severity", null: false + t.string "source" + t.datetime "resolved_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["exception_class", "message", "severity", "source"], name: "solid_error_uniqueness_index", unique: true + t.index ["resolved_at"], name: "index_solid_errors_on_resolved_at" + end + + create_table "solid_errors_occurrences", force: :cascade do |t| + t.integer "error_id", null: false + t.text "backtrace" + t.json "context" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["error_id"], name: "index_solid_errors_occurrences_on_error_id" + end + create_table "users", force: :cascade do |t| t.string "email", null: false t.string "password_digest", null: false @@ -131,4 +152,5 @@ end add_foreign_key "sessions", "users" + add_foreign_key "solid_errors_occurrences", "solid_errors", column: "error_id" end