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: 20171127171849_adds_common_id_to_endpoints.rb
    path of file: ./repos/catarse/db/migrate
    
    the code of the file until where you have to start completion: class AddsCommonIdToEndpoints < ActiveRecord::Migration
  def change
    execute <<-SQL
    CREATE
    OR replace view "1".reward_details AS         SELECT
        r.id,
        r.project_id,
        r.description,
        r.minimum_value,
        r.maximum_contributions,
        r.deliver_at,
        r.updated_at,
        paid_count(r.*) AS paid_count,
        waiting_payment_count(r.*) AS waiting_payment_count,
        r.shipping_options,
        r.row_order,
        r.title,
        s.sent_at  AS surve
    
  def change
    execute <<-SQL
    CREATE
    OR replace view "1".reward_details AS         SELECT
        r.id,
        r.project_id,
        r.description,
        r.minimum_value,
        r.maximum_contributions,
        r.deliver_at,
        r.updated_at,
        paid_count(r.*) AS paid_count,
        waiting_payment_count(r.*) AS waiting_payment_count,
        r.shipping_options,
        r.row_order,
        r.title,
        s.sent_at  AS survey_sent_at,
        s.finished_at AS survey_finished_at,
        r.common_id
    FROM
        rewards r
    LEFT JOIN
        surveys s
            on s.reward_id = r.id;
    SQL
  end