Merge pull request #7641 from tchak/chore-remove-ignored-columns

chore(db): remove ignored columns
This commit is contained in:
Paul Chavard 2022-08-02 15:30:35 +02:00 committed by GitHub
commit 2487cb47c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 18 deletions

View file

@ -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',

View file

@ -56,7 +56,6 @@
#
class Procedure < ApplicationRecord
self.ignored_columns = [:duree_conservation_dossiers_hors_ds]
include ProcedureStatsConcern
include EncryptableConcern

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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