Class: SunriseCreateFeedbackMessages

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

Class Method Summary collapse

Class Method Details

.downObject



22
23
24
# File 'lib/generators/sunrise/feedbacks/templates/create_feedback_messages.rb', line 22

def self.down
  drop_table :feedback_messages
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/sunrise/feedbacks/templates/create_feedback_messages.rb', line 2

def self.up
  create_table :feedback_messages do |t|
    t.string :user_name, :limit => 50
    t.string :user_email, :limit => 50
    t.integer :phone_number, :limit => 8
    t.text :content, :null => false
    t.text :content_html
    t.integer :answers_count, :default => 0

    t.integer :author_id
    t.string :author_type, :limit => 30
  
    t.timestamps
  end
  
  add_index :feedback_messages, [:author_type, :author_id]
  add_index :feedback_messages, :user_email
  add_index :feedback_messages, :phone_number
end