Skip to content

Commit

Permalink
Naming and simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Schaer committed Mar 7, 2021
1 parent 6c3a05e commit a74022f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions db/migrate/20210306220439_merge_bsv_and_training_days.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a74022f

Please sign in to comment.