2015-07-29 17:54:41 +03:00
|
|
|
class Participation < ActiveRecord::Base; end
|
|
|
|
class PersonalProfile < ActiveRecord::Base; end
|
|
|
|
|
2019-04-28 11:56:16 +03:00
|
|
|
class CreateParticipationRecords < ActiveRecord::Migration[4.2]
|
2015-07-29 17:54:41 +03:00
|
|
|
def up
|
2019-04-28 21:10:54 +03:00
|
|
|
event_to_speaker_profiles = execute "SELECT * FROM events_speaker_profiles"
|
2015-07-29 17:54:41 +03:00
|
|
|
|
|
|
|
event_to_speaker_profiles.each do |event_to_speaker_profile|
|
2019-04-28 21:10:54 +03:00
|
|
|
profile = PersonalProfile.find_by(id: event_to_speaker_profile["speaker_profile_id"])
|
|
|
|
next unless profile
|
2015-08-05 15:05:31 +03:00
|
|
|
|
2019-04-28 21:10:54 +03:00
|
|
|
Participation.create! event_id: event_to_speaker_profile["event_id"],
|
2015-08-05 15:05:31 +03:00
|
|
|
participant_id: profile.user_id,
|
2015-07-29 17:54:41 +03:00
|
|
|
approved: true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
Participation.destroy_all
|
|
|
|
end
|
|
|
|
end
|