class Tsuga::Adapter::ActiveRecord::Migration

Public Class Methods

included(by) click to toggle source
# File lib/tsuga/adapter/active_record/migration.rb, line 6
def self.included(by)
  by.extend(ClassMethods)
end

Public Instance Methods

down() click to toggle source
# File lib/tsuga/adapter/active_record/migration.rb, line 30
def down
  drop_table _clusters_table_name
end
up() click to toggle source
# File lib/tsuga/adapter/active_record/migration.rb, line 10
def up
  create_table _clusters_table_name do |t|
    t.string  :tilecode,       limit:32
    t.integer :depth,          limit:1
    t.string  :geohash,        limit:32
    t.float   :lat
    t.float   :lng
    t.integer :weight
    t.integer :parent_id
    t.string  :children_type
    t.text    :children_ids
    t.float   :sum_lat,        limit:53
    t.float   :sum_lng,        limit:53
    t.float   :ssq_lat,        limit:53
    t.float   :ssq_lng,        limit:53
  end

  add_index _clusters_table_name, :tilecode, using: :hash
end

Private Instance Methods

_clusters_table_name() click to toggle source
# File lib/tsuga/adapter/active_record/migration.rb, line 36
def _clusters_table_name
  self.class.clusters_table_name
end