Class: CreateLoggedEmails

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

Overview

Migration responsible for creating a table with logged_emails

Class Method Summary collapse

Class Method Details

.downObject

Drop table



30
31
32
# File 'lib/generators/mail_control/migration/templates/migration.rb', line 30

def self.down
  drop_table :logged_emails
end

.upObject

Create table



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/mail_control/migration/templates/migration.rb', line 4

def self.up
  create_table :logged_emails do |t|
    t.belongs_to :actor,      :polymorphic => true
    t.belongs_to :act_object, :polymorphic => true
    t.belongs_to :act_target, :polymorphic => true

    t.string  :verb
    t.string  :description
    t.string  :options
    t.string  :bond_type

    t.time :send_after
    t.time :send_before
    t.string :state

    t.string :unsubscribe_by

    t.timestamps
  end

  add_index :logged_emails, [:verb]
  add_index :logged_emails, [:actor_id, :actor_type]
  add_index :logged_emails, [:act_object_id, :act_object_type]
  add_index :logged_emails, [:act_target_id, :act_target_type]
end