Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amelioration ETQ tech/ops, on souhaite ne pas avoir d'index non utilisé (et plus maintenu) - bis #10825

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
Copy link
Member

@colinux colinux Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

t'es sûr que les colonnes ont été supprimées ?

en fait j'imagine que non, sinon il y aurait pas l'index, du coup si c'est le cas faudrait jouer une migration qui les supprime non?

Copy link
Contributor Author

@mfo mfo Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on met les ignored_columns avant de supprimer les colonnes, cf: https://github.com/ankane/strong_migrations?tab=readme-ov-file#how-it-works (vient de strong migration)

donc pr le moment je pensais juste les ignorer. et prochaine mep, les supprimer (pr pas avoir de desynchro entre les webs)

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_145757) 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 @@ -1136,7 +1136,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
Loading