2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-06-25 14:58:33 +02:00
|
|
|
class AddWeekToRegistration < ActiveRecord::Migration
|
|
|
|
|
class Registration < ActiveRecord::Base
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def up
|
|
|
|
|
add_column :registrations, :week, :integer
|
|
|
|
|
Registration.reset_column_information
|
|
|
|
|
Registration.find_each do |registration|
|
|
|
|
|
registration.week = registration.created_at.strftime('%W')
|
|
|
|
|
registration.save!
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def down
|
|
|
|
|
remove_column :registrations, :week
|
|
|
|
|
end
|
|
|
|
|
end
|