Class: CreateEmails

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

Overview

Everything listed in this migration will be added to a migration file inside of your main app.

Class Method Summary collapse

Class Method Details

.downObject



31
32
33
# File 'lib/generators/mailhopper/templates/migrations/create_emails.rb', line 31

def self.down
  drop_table :emails
end

.upObject



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
29
# File 'lib/generators/mailhopper/templates/migrations/create_emails.rb', line 4

def self.up
  create_table :emails do |t|
    t.string :from_address, :null => false

    t.string :reply_to_address,
             :subject

    # The following addresses have been defined as text fields to allow for multiple recipients. These fields could
    # instead be defined as strings, and even indexed, if you'd like to improve search performance and you can
    # confidently limit the size of their contents.

    t.text   :to_address,
             :cc_address,
             :bcc_address

    # The content field must be large enough to include the full content of emails, including any attachments. If you
    # do not plan to send any attachments or long emails, you could leave off this limit. In MySQL, this will result
    # in a TEXT column with a limit of 64KB characters. Otherwise, 100MB characters seems a safe limit for almost any
    # email. In MySQL, this will result in the creation of a LONGTEXT column with an actual limit of 4GB characters.

    t.text   :content, :limit => 100.megabytes

    t.datetime :sent_at
    t.timestamps
  end
end