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: 20171023011304_migrate_data_to_vendor.rb
    path of file: ./repos/ReadyResponder/db/migrate
    
    the code of the file until where you have to start completion: class MigrateDataToVendor < ActiveRecord::Migration[4.2]
  def up

    Item.all.each do |item|
      v = Vendor.w
    
  def up

    Item.all.each do |item|
      v = Vendor.where(
        name: item.source
      ).first_or_create

      item.vendor_id = v.id
      item.update_columns(vendor_id: v.id)
    end
  rename_column :items, :source, :source_data
  end