You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20151027050627_add_submission_grading_statistics.rb
    path of file: ./repos/coursemology2/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class AddSubmissionGradingStatistics < ActiveRecord::Migration[4.2]
  def up
    change_table :course_assessment_answers do |t|
      t.datetime :submitted_at
      t.references :grader, references: :users
    
    
  def up
    change_table :course_assessment_answers do |t|
      t.datetime :submitted_at
      t.references :grader, references: :users
      t.datetime :graded_at
    end

    root_user_id = exec_query('SELECT * FROM users').first['id']
    exec_query('SELECT * FROM course_assessment_answers').each do |row|
      if ['submitted', 'graded'].include?(row['workflow_state'])
        execute(<<-SQL)
          UPDATE course_assessment_answers
          SET submitted_at=NOW(), grade=0
          WHERE id=#{row['id']}
        SQL
      end

      next unless row['workflow_state'] == 'graded'

      execute(<<-SQL)
        UPDATE course_assessment_answers
        SET graded_at=NOW(), grader_id=#{root_user_id}
        WHERE id=#{row['id']}
      SQL
    end