diff --git a/app/models/dossier_operation_log.rb b/app/models/dossier_operation_log.rb index 131a29009..ac29ae529 100644 --- a/app/models/dossier_operation_log.rb +++ b/app/models/dossier_operation_log.rb @@ -14,8 +14,6 @@ # dossier_id :bigint # class DossierOperationLog < ApplicationRecord - self.ignored_columns = [:instructeur_id] - enum operation: { changer_groupe_instructeur: 'changer_groupe_instructeur', passer_en_instruction: 'passer_en_instruction', diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 96d3b00e3..fe8dc8ead 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -56,7 +56,6 @@ # class Procedure < ApplicationRecord - self.ignored_columns = [:duree_conservation_dossiers_hors_ds] include ProcedureStatsConcern include EncryptableConcern diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 20d0428c1..9a432958e 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -293,7 +293,11 @@ class ProcedurePresentation < ApplicationRecord end def find_type_de_champ(column) - TypeDeChamp.order(:revision_id).find_by(stable_id: column) + TypeDeChamp + .joins(:revision_types_de_champ) + .where(revision_types_de_champ: { revision_id: procedure.revisions }) + .order(:created_at) + .find_by(stable_id: column) end def check_allowed_displayed_fields diff --git a/app/models/user.rb b/app/models/user.rb index 5f2f63758..e27b0be18 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -41,8 +41,6 @@ class User < ApplicationRecord devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable - self.ignored_columns = [:administrateur_id, :instructeur_id, :expert_id] - has_many :dossiers, dependent: :destroy has_many :targeted_user_links, dependent: :destroy has_many :invites, dependent: :destroy diff --git a/db/migrate/20220728084804_remove_ignored_columns.rb b/db/migrate/20220728084804_remove_ignored_columns.rb new file mode 100644 index 000000000..3d74a73f9 --- /dev/null +++ b/db/migrate/20220728084804_remove_ignored_columns.rb @@ -0,0 +1,12 @@ +class RemoveIgnoredColumns < ActiveRecord::Migration[6.1] + def change + safety_assured do + remove_column :commentaires, :user_id + remove_column :dossiers, :en_construction_conservation_extension + remove_column :types_de_champ, :migrated_parent + remove_column :types_de_champ, :revision_id + remove_column :types_de_champ, :parent_id + remove_column :types_de_champ, :order_place + end + end +end diff --git a/db/schema.rb b/db/schema.rb index c0aae0e42..45a4b1464 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.define(version: 2022_07_26_151017) do +ActiveRecord::Schema.define(version: 2022_07_28_084804) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -222,11 +222,9 @@ ActiveRecord::Schema.define(version: 2022_07_26_151017) do t.bigint "expert_id" t.bigint "instructeur_id" t.datetime "updated_at", null: false - t.bigint "user_id" t.index ["dossier_id"], name: "index_commentaires_on_dossier_id" t.index ["expert_id"], name: "index_commentaires_on_expert_id" t.index ["instructeur_id"], name: "index_commentaires_on_instructeur_id" - t.index ["user_id"], name: "index_commentaires_on_user_id" end create_table "delayed_jobs", id: :serial, force: :cascade do |t| @@ -311,7 +309,6 @@ ActiveRecord::Schema.define(version: 2022_07_26_151017) do t.bigint "dossier_transfer_id" t.datetime "en_construction_at" t.datetime "en_construction_close_to_expiration_notice_sent_at" - t.interval "en_construction_conservation_extension", default: "PT0S" t.datetime "en_instruction_at" t.boolean "for_procedure_preview", default: false t.bigint "groupe_instructeur_id" @@ -798,18 +795,12 @@ ActiveRecord::Schema.define(version: 2022_07_26_151017) do t.text "description" t.string "libelle" t.boolean "mandatory", default: false - t.boolean "migrated_parent" t.jsonb "options" - t.integer "order_place" - t.bigint "parent_id" t.boolean "private", default: false, null: false - t.bigint "revision_id" t.bigint "stable_id" t.string "type_champ" t.datetime "updated_at" - t.index ["parent_id"], name: "index_types_de_champ_on_parent_id" t.index ["private"], name: "index_types_de_champ_on_private" - t.index ["revision_id"], name: "index_types_de_champ_on_revision_id" t.index ["stable_id"], name: "index_types_de_champ_on_stable_id" end @@ -922,8 +913,6 @@ ActiveRecord::Schema.define(version: 2022_07_26_151017) do add_foreign_key "targeted_user_links", "users" add_foreign_key "traitements", "dossiers" add_foreign_key "trusted_device_tokens", "instructeurs" - add_foreign_key "types_de_champ", "procedure_revisions", column: "revision_id" - add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id" add_foreign_key "users", "users", column: "requested_merge_into_id" add_foreign_key "without_continuation_mails", "procedures" end