Class: AddCampaignsAndTemplates

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
db/migrate/20100916175000_add_campaigns_and_templates.rb

Class Method Summary collapse

Class Method Details

.downObject



51
52
53
54
55
56
57
58
# File 'db/migrate/20100916175000_add_campaigns_and_templates.rb', line 51

def self.down
	drop_table :campaigns
	drop_table :email_templates
	drop_table :attachments
	drop_table :attachments_email_templates
	drop_table :email_addresses
	drop_table :web_templates
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'db/migrate/20100916175000_add_campaigns_and_templates.rb', line 4

def self.up
	create_table :campaigns do |t|
		t.integer   :workspace_id, :null => false
		t.string    :name, :limit => 512
		# Serialized, stores SMTP/other protocol config options etc.
		t.text      :prefs
		t.integer   :status, :default => 0
		t.timestamp :started_at
		t.timestamps
	end

	create_table :email_templates do |t|
		t.string  :name,    :limit => 512
		t.string  :subject, :limit => 1024
		t.text    :body
		t.integer :parent_id
		t.integer :campaign_id
	end
	create_table :attachments do |t|
		t.string  :name,    :limit => 512
		t.binary  :data
		t.string  :content_type, :limit => 512
		t.boolean :inline,  :null => false, :default => true
		t.boolean :zip,     :null => false, :default => false
	end
	create_table :attachments_email_templates, :id => false do |t|
		t.integer :attachment_id
		t.integer :email_template_id
	end

	create_table :email_addresses do |t|
		t.integer :campaign_id, :null => false
		t.string  :first_name,  :limit => 512
		t.string  :last_name,   :limit => 512
		t.string  :address,     :limit => 512
		t.boolean :sent,        :null => false, :default => false
		t.timestamp :clicked_at
	end

	create_table :web_templates do |t|
		t.string  :name,    :limit => 512
		t.string  :title,   :limit => 512
		t.string  :body,    :limit => 524288
		t.integer :campaign_id
	end
end