Class: CreateComments

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/tkh_content/create_or_update_migrations/templates/create_comments.rb

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
21
22
23
24
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_comments.rb', line 18

def self.down
  drop_table :comments
  remove_index :comments, :page_id
  remove_index :comments, :author_id
  remove_index :comments, :locale
  remove_index :comments, :status
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_comments.rb', line 3

def self.up
  create_table :comments do |t|
    t.text :body
    t.integer :page_id
    t.integer :author_id
    t.string :locale
    t.string :status, :default => 'pending'
    t.timestamps
  end
  add_index :comments, :page_id
  add_index :comments, :author_id
  add_index :comments, :locale
  add_index :comments, :status
end