From f55c7a05128acfa6055af04a3a349e410faf89e6 Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Fri, 8 Sep 2017 11:52:20 +0200 Subject: [PATCH] Avis: add confidentiel field --- .../20170908094900_add_confidentiel_field_to_avis.rb | 5 +++++ db/schema.rb | 9 +++++---- .../2017_09_19_set_confidentialite_to_old_avis.rake | 5 +++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20170908094900_add_confidentiel_field_to_avis.rb create mode 100644 lib/tasks/2017_09_19_set_confidentialite_to_old_avis.rake diff --git a/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb b/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb new file mode 100644 index 000000000..eed554510 --- /dev/null +++ b/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb @@ -0,0 +1,5 @@ +class AddConfidentielFieldToAvis < ActiveRecord::Migration[5.0] + def change + add_column :avis, :confidentiel, :boolean, default: false, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 04ae79e32..ec4a5d01a 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: 20170801083632) do +ActiveRecord::Schema.define(version: 20170908101023) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -99,9 +99,10 @@ ActiveRecord::Schema.define(version: 20170801083632) do t.text "answer" t.integer "gestionnaire_id" t.integer "dossier_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "claimant_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "claimant_id", null: false + t.boolean "confidentiel", default: false, null: false t.index ["claimant_id"], name: "index_avis_on_claimant_id", using: :btree t.index ["dossier_id"], name: "index_avis_on_dossier_id", using: :btree t.index ["gestionnaire_id"], name: "index_avis_on_gestionnaire_id", using: :btree diff --git a/lib/tasks/2017_09_19_set_confidentialite_to_old_avis.rake b/lib/tasks/2017_09_19_set_confidentialite_to_old_avis.rake new file mode 100644 index 000000000..9579811da --- /dev/null +++ b/lib/tasks/2017_09_19_set_confidentialite_to_old_avis.rake @@ -0,0 +1,5 @@ +namespace :'2017_09_19_set_confidentialite_to_old_avis' do + task set: :environment do + Avis.unscoped.update_all(confidentiel: true) + end +end