Skip to content

Commit

Permalink
tech(clean): unused index and column
Browse files Browse the repository at this point in the history
  • Loading branch information
mfo committed Sep 20, 2024
1 parent b7a898e commit 6ed5630
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/traitement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Traitement < ApplicationRecord
belongs_to :dossier, optional: false

self.ignored_columns += [:process_expired, :process_expired_migrated]
scope :en_construction, -> { where(state: Dossier.states.fetch(:en_construction)) }
scope :en_instruction, -> { where(state: Dossier.states.fetch(:en_instruction)) }
scope :termine, -> { where(state: Dossier::TERMINE) }
Expand Down
7 changes: 7 additions & 0 deletions db/migrate/20240919151603_drop_dead_indices.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class DropDeadIndices < ActiveRecord::Migration[7.0]
def change
remove_index :traitements, :process_expired
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_09_19_130351) do
ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_buffercache"
enable_extension "pg_stat_statements"
Expand Down Expand Up @@ -1138,7 +1138,6 @@
t.datetime "processed_at", precision: nil
t.string "state"
t.index ["dossier_id"], name: "index_traitements_on_dossier_id"
t.index ["process_expired"], name: "index_traitements_on_process_expired"
end

create_table "trusted_device_tokens", force: :cascade do |t|
Expand Down
1 change: 0 additions & 1 deletion spec/factories/traitement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
FactoryBot.define do
factory :traitement do
trait :accepte do
process_expired { true }
state { :accepte }
end
end
Expand Down

0 comments on commit 6ed5630

Please sign in to comment.