You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
568 B
15 lines
568 B
class MigrateCompetitionChartRules < ActiveRecord::Migration[5.2]
|
|
def change
|
|
add_column :competition_module_md_contents, :competition_stage_id, :integer, default: 0
|
|
|
|
ChartRule.all.each do |rule|
|
|
if rule.competition
|
|
com_module = rule.competition.competition_modules.find_by(module_type: "chart")
|
|
if com_module
|
|
CompetitionModuleMdContent.create!(content: rule.content, competition_module_id: com_module.id, competition_stage_id: rule.competition_stage_id ? rule.competition_stage_id : 0)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|