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: 20130910215544_add_order_to_locations_types.rb
    path of file: ./repos/falling-fruit/db/migrate
    
    the code of the file until where you have to start completion: class AddOrderToLocationsTypes < ActiveRecord::Migration
  class LocationsType < ActiveRecord::Base
    self.table_name = 'locations
    
  def change
    change_table :locations_types do |t|
      t.integer :position
    end
    puts "Adding Order"
    n = 0
    p = 0
    c = LocationsType.count
    lid = nil
    LocationsType.order("location_id, id ASC").each{ |lt|
      if lid.nil? or lt.location_id != lid
        p = 0
        lid = lt.location_id
      end