Class: CreateSections

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

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
19
20
21
# File 'lib/generators/templates/migration_section.rb', line 16

def self.down
  drop_table :survey_sections
  
  remove_column :survey_questions, :section_id
  add_column :survey_questions, :survey_id, :integer
end

.upObject



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

def self.up
  create_table :survey_sections do |t|
    t.string  :head_number
    t.string  :name
    t.text    :description
    t.integer :survey_id
    
    t.timestamps
  end
  
  remove_column :survey_questions, :survey_id
  add_column :survey_questions, :section_id, :integer
end