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.
educoder/db/migrate/20190911080150_change_ec_co...

12 lines
394 B

class ChangeEcCourseSupports < ActiveRecord::Migration[5.2]
def change
add_column :ec_course_supports, :ec_graduation_subitem_id, :integer, index: true
execute <<-SQL
UPDATE ec_course_supports ecs SET ec_graduation_subitem_id = (
SELECT ec_graduation_subitem_id FROM ec_graduation_subitem_courses egsc WHERE egsc.ec_course_support_id = ecs.id
)
SQL
end
end