Class: SunriseCreateQuestions

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

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/sunrise/questions/templates/create_questions.rb', line 17

def self.down
  drop_table :questions
end

.upObject



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

def self.up
  create_table :questions do |t|
    t.integer :structure_id
    t.string :title, :null => false
    t.text :content
    
    t.boolean :is_visible, :default => true
    t.integer :sort_order, :default => 0
    
    t.timestamps
  end
  
  add_index :questions, :structure_id
end