mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
19 lines
443 B
Ruby
19 lines
443 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|