Class: UnreadMigration

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

Class Method Summary collapse

Class Method Details

.downObject



13
14
15
# File 'lib/generators/unread/migration/templates/migration.rb', line 13

def self.down
  drop_table :read_marks
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/unread/migration/templates/migration.rb', line 2

def self.up
  create_table :read_marks, :force => true do |t|
    t.integer  :readable_id
    t.integer  :user_id,       :null => false
    t.string   :readable_type, :null => false, :limit => 20
    t.datetime :timestamp
  end

  add_index :read_marks, [:user_id, :readable_type, :readable_id]
end