Class: CreateGritterNoticesTable

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

Class Method Summary collapse

Class Method Details

.downObject



20
21
22
# File 'lib/generators/templates/migration.rb', line 20

def self.down
  drop_table :gritter_notices
end

.upObject



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

def self.up
  create_table :gritter_notices, :force => true do |t|
    t.integer  :owner_id,                            :null => false
    t.string   :owner_type,                          :null => false
    t.text     :text,                                :null => false
    # t.string   :level,        :default => "notice", :null => false
    # t.string   :title
    # t.string   :image
    # t.boolean  :sticky, :default=>false, :null=>false
    t.text     :options, :null=>false
    t.datetime :delivered_at
    t.datetime :created_at
    t.datetime :updated_at
  end

  add_index :gritter_notices, [:owner_id, :delivered_at]
end