Class: SunriseCreateFeedbackAnswers

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/sunrise/feedbacks/templates/create_feedback_answers.rb

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/sunrise/feedbacks/templates/create_feedback_answers.rb', line 17

def self.down
  drop_table :feedback_answers
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/sunrise/feedbacks/templates/create_feedback_answers.rb', line 2

def self.up
  create_table :feedback_answers do |t|
    t.text :content, :null => false
    t.integer :message_id, :null => false
    
    t.integer :author_id
    t.string :author_type, :limit => 30
  
    t.timestamps
  end
  
  add_index :feedback_answers, [:author_type, :author_id]
  add_index :feedback_answers, :message_id
end