Merge pull request #6071 from tchak/remove-unused-columns

Remove unused columns
This commit is contained in:
Paul Chavard 2021-04-08 13:07:00 +01:00 committed by GitHub
commit a88f780252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 16 deletions

View file

@ -14,6 +14,8 @@
# procedure_id :integer
#
class AssignTo < ApplicationRecord
self.ignored_columns = [:procedure_id]
belongs_to :instructeur, optional: false
belongs_to :groupe_instructeur, optional: false
has_one :procedure_presentation, dependent: :destroy

View file

@ -9,13 +9,11 @@
# email :string
# introduction :text
# revoked_at :datetime
# tmp_expert_migrated :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
# claimant_id :integer not null
# dossier_id :integer
# experts_procedure_id :bigint
# instructeur_id :integer
#
class Avis < ApplicationRecord
include EmailSanitizableConcern

View file

@ -489,8 +489,7 @@ class Dossier < ApplicationRecord
else
avis
.where(confidentiel: false)
.or(avis.where(claimant_id: instructeur.id, claimant_type: 'Instructeur'))
.or(avis.where(instructeur: instructeur))
.or(avis.where(claimant: instructeur))
.order(created_at: :asc)
end
end
@ -499,11 +498,9 @@ class Dossier < ApplicationRecord
if expert.dossiers.include?(self)
avis.order(created_at: :asc)
else
instructeur = expert.user.instructeur.id if expert.user.instructeur
avis
.where(confidentiel: false)
.or(avis.where(claimant_id: expert.id, claimant_type: 'Expert', tmp_expert_migrated: true))
.or(avis.where(claimant_id: instructeur, claimant_type: 'Instructeur', tmp_expert_migrated: false))
.or(avis.where(claimant: expert))
.order(created_at: :asc)
end
end

View file

@ -0,0 +1,11 @@
class DropUnusedColumns < ActiveRecord::Migration[6.1]
def change
remove_column :avis, :instructeur_id
remove_column :avis, :tmp_expert_migrated
remove_column :etablissements, :entreprise_id
remove_column :procedures, :archived_at
remove_column :procedures, :csv_export_queued
remove_column :procedures, :xlsx_export_queued
remove_column :procedures, :ods_export_queued
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: 2021_04_02_163003) do
ActiveRecord::Schema.define(version: 2021_04_07_174523) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -121,7 +121,6 @@ ActiveRecord::Schema.define(version: 2021_04_02_163003) do
t.string "email"
t.text "introduction"
t.text "answer"
t.integer "instructeur_id"
t.integer "dossier_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@ -130,11 +129,9 @@ ActiveRecord::Schema.define(version: 2021_04_02_163003) do
t.datetime "revoked_at"
t.bigint "experts_procedure_id"
t.string "claimant_type"
t.boolean "tmp_expert_migrated", default: false
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
t.index ["experts_procedure_id"], name: "index_avis_on_experts_procedure_id"
t.index ["instructeur_id"], name: "index_avis_on_instructeur_id"
end
create_table "bill_signatures", force: :cascade do |t|
@ -291,7 +288,6 @@ ActiveRecord::Schema.define(version: 2021_04_02_163003) do
t.string "localite"
t.string "code_insee_localite"
t.integer "dossier_id"
t.integer "entreprise_id"
t.string "entreprise_siren"
t.bigint "entreprise_capital_social"
t.string "entreprise_numero_tva_intracommunautaire"
@ -532,7 +528,6 @@ ActiveRecord::Schema.define(version: 2021_04_02_163003) do
t.date "auto_archive_on"
t.datetime "published_at"
t.datetime "hidden_at"
t.datetime "archived_at"
t.datetime "whitelisted_at"
t.boolean "ask_birthday", default: false, null: false
t.string "web_hook_url"
@ -550,9 +545,6 @@ ActiveRecord::Schema.define(version: 2021_04_02_163003) do
t.string "declarative_with_state"
t.text "monavis_embed"
t.text "routing_criteria_name", default: "Votre ville"
t.boolean "csv_export_queued"
t.boolean "xlsx_export_queued"
t.boolean "ods_export_queued"
t.datetime "closed_at"
t.datetime "unpublished_at"
t.bigint "canonical_procedure_id"