Class: CreateCities

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

Overview

Create city migration file

Instance Method Summary collapse

Instance Method Details

#changeObject



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

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

    t.timestamps null: false
  end
end