[Bugfix] Conference methods related to weeks now database independent

This commit is contained in:
Chrisbr 2014-06-25 14:58:33 +02:00
parent fd95570c02
commit 596027e49b
6 changed files with 55 additions and 4 deletions

View file

@ -0,0 +1,17 @@
class AddWeekToEvent < ActiveRecord::Migration
class Event < ActiveRecord::Base
end
def up
add_column :events, :week, :integer
Event.reset_column_information
Event.find_each do |event|
event.week = event.created_at.strftime('%W')
event.save!
end
end
def down
remove_column :events, :week
end
end

View file

@ -0,0 +1,17 @@
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