Class: CreateArticles

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/db/migrate/20091226230412_create_articles.rb

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
20
21
22
# File 'lib/db/migrate/20091226230412_create_articles.rb', line 17

def self.down
  remove_index :articles, :title_slug
  remove_index :articles, :user_id
  
  drop_table :articles
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/db/migrate/20091226230412_create_articles.rb', line 2

def self.up
  create_table :articles do |t|
    t.string :title
    t.string :title_slug
    t.text :body
    t.text :body_html
    t.integer :user_id
    
    t.timestamps
  end
  
  add_index :articles, :title_slug
  add_index :articles, :user_id
end