Class: CreateEntries

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/days/migrate/20121221000000_create_entries.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/days/migrate/20121221000000_create_entries.rb', line 2

def change
  create_table :entries do |t|
    t.string   :title,       null: false
    t.text     :body,        null: false
    t.text     :rendered,    null: false
    t.string   :slug,        null: false, unique: true
    t.integer  :user_id
    t.datetime :published_at

    t.timestamps
  end

  add_index :entries, :published_at
  add_index :entries, :user_id
  add_index :entries, :slug
end