Class: CreateNeighborhoods

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

Overview

Create neighborhood migration file

Instance Method Summary collapse

Instance Method Details

#changeObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/templates/migrations/create_neighborhoods.rb', line 3

def change
  create_table :neighborhoods do |t|
    t.string :name
    t.string :zip_code
    t.references :city, index: true, foreign_key: true
    t.references :state, index: true, foreign_key: true

    t.timestamps null: false
  end
end