Merge pull request #10847 from mfo/US/clean-db
amélioration : ETQ tech je souhatie que ma base de donnée ne stock pas de donnée inutile
This commit is contained in:
commit
12ef66c2b0
7 changed files with 20 additions and 25 deletions
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Dossier < ApplicationRecord
|
class Dossier < ApplicationRecord
|
||||||
self.ignored_columns += [:re_instructed_at, :search_terms, :private_search_terms]
|
self.ignored_columns += [:search_terms, :private_search_terms]
|
||||||
|
|
||||||
include DossierCloneConcern
|
include DossierCloneConcern
|
||||||
include DossierCorrectableConcern
|
include DossierCorrectableConcern
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Instructeur < ApplicationRecord
|
class Instructeur < ApplicationRecord
|
||||||
self.ignored_columns += [:agent_connect_id]
|
|
||||||
|
|
||||||
include UserFindByConcern
|
include UserFindByConcern
|
||||||
has_and_belongs_to_many :administrateurs
|
has_and_belongs_to_many :administrateurs
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,6 @@ class Procedure < ApplicationRecord
|
||||||
|
|
||||||
include Discard::Model
|
include Discard::Model
|
||||||
self.discard_column = :hidden_at
|
self.discard_column = :hidden_at
|
||||||
self.ignored_columns += [
|
|
||||||
:direction,
|
|
||||||
:durees_conservation_required,
|
|
||||||
:cerfa_flag,
|
|
||||||
:test_started_at,
|
|
||||||
:lien_demarche
|
|
||||||
]
|
|
||||||
|
|
||||||
default_scope -> { kept }
|
default_scope -> { kept }
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
class Traitement < ApplicationRecord
|
class Traitement < ApplicationRecord
|
||||||
belongs_to :dossier, optional: false
|
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_construction, -> { where(state: Dossier.states.fetch(:en_construction)) }
|
||||||
scope :en_instruction, -> { where(state: Dossier.states.fetch(:en_instruction)) }
|
scope :en_instruction, -> { where(state: Dossier.states.fetch(:en_instruction)) }
|
||||||
scope :termine, -> { where(state: Dossier::TERMINE) }
|
scope :termine, -> { where(state: Dossier::TERMINE) }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TypeDeChamp < ApplicationRecord
|
class TypeDeChamp < ApplicationRecord
|
||||||
self.ignored_columns += [:migrated_parent, :revision_id, :parent_id, :order_place]
|
|
||||||
|
|
||||||
FILE_MAX_SIZE = 200.megabytes
|
FILE_MAX_SIZE = 200.megabytes
|
||||||
FEATURE_FLAGS = {
|
FEATURE_FLAGS = {
|
||||||
engagement_juridique: :engagement_juridique_type_de_champ,
|
engagement_juridique: :engagement_juridique_type_de_champ,
|
||||||
|
|
18
db/migrate/20240923125619_drop_ignored_columns.rb
Normal file
18
db/migrate/20240923125619_drop_ignored_columns.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class DropIgnoredColumns < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
safety_assured do
|
||||||
|
remove_column :dossiers, :re_instructed_at
|
||||||
|
remove_column :instructeurs, :agent_connect_id
|
||||||
|
remove_column :procedures, :direction
|
||||||
|
remove_column :procedures, :durees_conservation_required
|
||||||
|
remove_column :procedures, :cerfa_flag
|
||||||
|
remove_column :procedures, :test_started_at
|
||||||
|
remove_column :procedures, :lien_demarche
|
||||||
|
remove_column :traitements, :process_expired
|
||||||
|
remove_column :traitements, :process_expired_migrated
|
||||||
|
remove_column :active_storage_blobs, :lock_version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
db/schema.rb
13
db/schema.rb
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
ActiveRecord::Schema[7.0].define(version: 2024_09_23_125619) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_buffercache"
|
enable_extension "pg_buffercache"
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
|
@ -47,7 +47,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.datetime "created_at", precision: nil, null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.string "filename", null: false
|
t.string "filename", null: false
|
||||||
t.string "key", null: false
|
t.string "key", null: false
|
||||||
t.integer "lock_version"
|
|
||||||
t.text "metadata"
|
t.text "metadata"
|
||||||
t.string "service_name", null: false
|
t.string "service_name", null: false
|
||||||
t.string "virus_scan_result"
|
t.string "virus_scan_result"
|
||||||
|
@ -500,7 +499,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.boolean "prefilled"
|
t.boolean "prefilled"
|
||||||
t.string "private_search_terms"
|
t.string "private_search_terms"
|
||||||
t.datetime "processed_at", precision: nil
|
t.datetime "processed_at", precision: nil
|
||||||
t.datetime "re_instructed_at"
|
|
||||||
t.bigint "revision_id"
|
t.bigint "revision_id"
|
||||||
t.string "search_terms"
|
t.string "search_terms"
|
||||||
t.string "state"
|
t.string "state"
|
||||||
|
@ -796,7 +794,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "instructeurs", id: :serial, force: :cascade do |t|
|
create_table "instructeurs", id: :serial, force: :cascade do |t|
|
||||||
t.string "agent_connect_id"
|
|
||||||
t.string "agent_connect_id_token"
|
t.string "agent_connect_id_token"
|
||||||
t.boolean "bypass_email_login_token", default: false, null: false
|
t.boolean "bypass_email_login_token", default: false, null: false
|
||||||
t.datetime "created_at", precision: nil
|
t.datetime "created_at", precision: nil
|
||||||
|
@ -804,7 +801,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.datetime "login_token_created_at", precision: nil
|
t.datetime "login_token_created_at", precision: nil
|
||||||
t.datetime "updated_at", precision: nil
|
t.datetime "updated_at", precision: nil
|
||||||
t.bigint "user_id", null: false
|
t.bigint "user_id", null: false
|
||||||
t.index ["agent_connect_id"], name: "index_instructeurs_on_agent_connect_id", unique: true
|
|
||||||
t.index ["user_id"], name: "index_instructeurs_on_user_id"
|
t.index ["user_id"], name: "index_instructeurs_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -916,7 +912,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.date "auto_archive_on"
|
t.date "auto_archive_on"
|
||||||
t.string "cadre_juridique"
|
t.string "cadre_juridique"
|
||||||
t.bigint "canonical_procedure_id"
|
t.bigint "canonical_procedure_id"
|
||||||
t.boolean "cerfa_flag", default: false
|
|
||||||
t.jsonb "chorus", default: {}, null: false
|
t.jsonb "chorus", default: {}, null: false
|
||||||
t.boolean "cloned_from_library", default: false
|
t.boolean "cloned_from_library", default: false
|
||||||
t.datetime "closed_at", precision: nil
|
t.datetime "closed_at", precision: nil
|
||||||
|
@ -930,12 +925,10 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "description_pj"
|
t.string "description_pj"
|
||||||
t.string "description_target_audience"
|
t.string "description_target_audience"
|
||||||
t.string "direction"
|
|
||||||
t.datetime "dossiers_count_computed_at", precision: nil
|
t.datetime "dossiers_count_computed_at", precision: nil
|
||||||
t.bigint "draft_revision_id"
|
t.bigint "draft_revision_id"
|
||||||
t.integer "duree_conservation_dossiers_dans_ds"
|
t.integer "duree_conservation_dossiers_dans_ds"
|
||||||
t.boolean "duree_conservation_etendue_par_ds", default: false, null: false
|
t.boolean "duree_conservation_etendue_par_ds", default: false, null: false
|
||||||
t.boolean "durees_conservation_required", default: true
|
|
||||||
t.string "encrypted_api_particulier_token"
|
t.string "encrypted_api_particulier_token"
|
||||||
t.integer "estimated_dossiers_count"
|
t.integer "estimated_dossiers_count"
|
||||||
t.boolean "estimated_duration_visible", default: true, null: false
|
t.boolean "estimated_duration_visible", default: true, null: false
|
||||||
|
@ -949,7 +942,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.boolean "instructeurs_self_management_enabled", default: false
|
t.boolean "instructeurs_self_management_enabled", default: false
|
||||||
t.boolean "juridique_required", default: true
|
t.boolean "juridique_required", default: true
|
||||||
t.string "libelle"
|
t.string "libelle"
|
||||||
t.string "lien_demarche"
|
|
||||||
t.string "lien_dpo"
|
t.string "lien_dpo"
|
||||||
t.text "lien_dpo_error"
|
t.text "lien_dpo_error"
|
||||||
t.string "lien_notice"
|
t.string "lien_notice"
|
||||||
|
@ -971,7 +963,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.jsonb "sva_svr", default: {}, null: false
|
t.jsonb "sva_svr", default: {}, null: false
|
||||||
t.text "tags", default: [], array: true
|
t.text "tags", default: [], array: true
|
||||||
t.boolean "template", default: false, null: false
|
t.boolean "template", default: false, null: false
|
||||||
t.datetime "test_started_at", precision: nil
|
|
||||||
t.datetime "unpublished_at", precision: nil
|
t.datetime "unpublished_at", precision: nil
|
||||||
t.datetime "updated_at", precision: nil, null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.string "web_hook_url"
|
t.string "web_hook_url"
|
||||||
|
@ -1131,8 +1122,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_19_151603) do
|
||||||
t.bigint "dossier_id"
|
t.bigint "dossier_id"
|
||||||
t.string "instructeur_email"
|
t.string "instructeur_email"
|
||||||
t.string "motivation"
|
t.string "motivation"
|
||||||
t.boolean "process_expired"
|
|
||||||
t.boolean "process_expired_migrated", default: false
|
|
||||||
t.datetime "processed_at", precision: nil
|
t.datetime "processed_at", precision: nil
|
||||||
t.string "state"
|
t.string "state"
|
||||||
t.index ["dossier_id"], name: "index_traitements_on_dossier_id"
|
t.index ["dossier_id"], name: "index_traitements_on_dossier_id"
|
||||||
|
|
Loading…
Reference in a new issue