Class: OrochiMigration

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/orochi/templates/migrations/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



27
28
29
30
31
32
# File 'lib/generators/orochi/templates/migrations/migration.rb', line 27

def self.down
  drop_table :routers
  drop_table :routes
  drop_table :legs
  drop_table :steps
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/orochi/templates/migrations/migration.rb', line 2

def self.up
  create_table :routers do |t|
    t.string :start
    t.string :stop
    t.timestamps
  end
  
  create_table :routes do |t|
    t.integer :router_id, :references => :routers
    t.timestamps
  end

  create_table :legs do |t|
    t.integer :route_id, :references => :routes
    t.timestamps
  end

  create_table :steps do |t|
    t.integer :leg_id, :references => :legs
    t.text :polyline_json
    t.text :directions_json
    t.timestamps
  end
end