From cba3ecbb17dda6267488d0f73ff923a6cd15d72d Mon Sep 17 00:00:00 2001 From: Michael-Schaer Date: Sun, 7 Mar 2021 14:27:50 +0100 Subject: [PATCH] Naming and simplification --- ...210306220439_merge_bsv_and_training_days.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 db/migrate/20210306220439_merge_bsv_and_training_days.rb diff --git a/db/migrate/20210306220439_merge_bsv_and_training_days.rb b/db/migrate/20210306220439_merge_bsv_and_training_days.rb new file mode 100644 index 000000000..0a8438eb9 --- /dev/null +++ b/db/migrate/20210306220439_merge_bsv_and_training_days.rb @@ -0,0 +1,18 @@ +# Copyright (c) 2021, Pfadibewegung Schweiz. This file is part of +# hitobito_pbs and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/hitobito/hitobito_pbs. + +class MergeBsvAndTrainingDays < ActiveRecord::Migration[6.0] + def up + rename_column:event_participations, :bsv_days, :training_days + Event.update_all "training_days = bsv_days" + remove_column :events, :bsv_days + end + + def down + rename_column:event_participations, :training_days, :bsv_days + add_column :events, :bsv_days, :decimal, scale: 2, precision: 6 + Event.update_all "bsv_days = training_days" + end +end