aboutsummaryrefslogtreecommitdiffstats
path: root/db/migrate/071_add_exim_log.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/071_add_exim_log.rb')
-rw-r--r--db/migrate/071_add_exim_log.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/db/migrate/071_add_exim_log.rb b/db/migrate/071_add_exim_log.rb
new file mode 100644
index 000000000..d40383698
--- /dev/null
+++ b/db/migrate/071_add_exim_log.rb
@@ -0,0 +1,34 @@
+class AddEximLog < ActiveRecord::Migration
+ def self.up
+ create_table :exim_logs do |t|
+ t.column :exim_log_done_id, :integer
+ t.column :info_request_id, :integer
+
+ t.column :order, :integer, :null => false
+ t.column :line, :text, :null => false
+
+ t.column :created_at, :datetime, :null => false
+ t.column :updated_at, :datetime, :null => false
+ end
+
+ create_table :exim_log_dones do |t|
+ t.column :filename, :text, :null => false, :unique => true
+ t.column :last_stat, :datetime, :null => false
+
+ t.column :created_at, :datetime, :null => false
+ t.column :updated_at, :datetime, :null => false
+ end
+ add_index :exim_log_dones, :last_stat
+
+ if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
+ execute "ALTER TABLE exim_logs ADD CONSTRAINT fk_exim_log_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id)"
+ execute "ALTER TABLE exim_logs ADD CONSTRAINT fk_exim_log_done FOREIGN KEY (exim_log_done_id) REFERENCES exim_log_dones(id)"
+ end
+ end
+
+ def self.down
+ drop_table :exim_logs
+ drop_table :exim_log_dones
+ end
+end
+