Class: CreateSharpZones

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

Class Method Summary collapse

Class Method Details

.downObject



23
24
25
26
27
# File 'lib/generators/sharp_zones/templates/migration.rb', line 23

def self.down
  drop_table :cities
  drop_table :provinces
  drop_table :zones
end

.upObject



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

def self.up
  create_table "cities", :force => true do |t|
    t.integer "province_id",          :null => false
    t.string  "name"
    t.timestamps
  end
  add_index "cities", "province_id"

  create_table "provinces", :force => true do |t|
    t.string  "name"
    t.timestamps
  end

  create_table "zones", :force => true do |t|
    t.string   "name",       :null => false
    t.integer  "city_id",  :null => false
    t.timestamps
  end
  add_index "zones", "city_id"
end