Class: SunriseCreateWidgets

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

Class Method Summary collapse

Class Method Details

.downObject



21
22
23
# File 'lib/generators/sunrise/widgets/templates/create_widgets.rb', line 21

def self.down
  drop_table :widgets
end

.upObject



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

def self.up
  create_table :widgets 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.integer :widget_type_id, :limit => 1, :default => 0
    t.integer :widget_position_id, :limit => 1, :default => 0
    
    t.timestamps
  end
  
  add_index :widgets, :structure_id
  add_index :widgets, :widget_position_id
  add_index :widgets, :widget_type_id
end