Class: CreateTableAddresses

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

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/address_by_cep/templates/migration.rb', line 17

def self.down
  drop_table :addresses
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/address_by_cep/templates/migration.rb', line 2

def self.up
  create_table :addresses do |t|
    t.string :zip_code
    t.string :street
    t.string :number
    t.string :neighborhood
    t.string :city
    t.string :state
    t.string :complement
    t.references :addressable, :polymorphic => true
    
    t.timestamps
  end
end