Module: Tsuga::Adapter::ActiveRecord::Migration

Included in:
Test::Migration
Defined in:
lib/tsuga/adapter/active_record/migration.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(by) ⇒ Object



6
7
8
# File 'lib/tsuga/adapter/active_record/migration.rb', line 6

def self.included(by)
  by.extend(ClassMethods)
end

Instance Method Details

#downObject



30
31
32
# File 'lib/tsuga/adapter/active_record/migration.rb', line 30

def down
  drop_table _clusters_table_name
end

#upObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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