Class: SunriseCreateHeaders

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

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/sunrise/templates/migrate/create_headers.rb', line 17

def self.down
  drop_table :headers
end

.upObject



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

def self.up
  create_table :headers do |t|
    t.string    :title
    t.string    :keywords
    t.text      :description
    
    t.string    :headerable_type, :limit => 30, :null => false
    t.integer   :headerable_id, :null => false
    
    t.timestamps
  end
  
  add_index :headers, [:headerable_type, :headerable_id], :uniq => true, :name => "fk_headerable"
end