diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/071_add_exim_log.rb | 34 | ||||
-rw-r--r-- | db/schema.rb | 20 |
2 files changed, 53 insertions, 1 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 + diff --git a/db/schema.rb b/db/schema.rb index e0b8d6217..f9d59bc88 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 70) do +ActiveRecord::Schema.define(:version => 71) do create_table "acts_as_xapian_jobs", :force => true do |t| t.string "model", :null => false @@ -41,6 +41,24 @@ ActiveRecord::Schema.define(:version => 70) do t.datetime "updated_at", :null => false end + create_table "exim_log_dones", :force => true do |t| + t.text "filename", :null => false + t.datetime "last_stat", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "exim_log_dones", ["last_stat"], :name => "index_exim_log_dones_on_last_stat" + + create_table "exim_logs", :force => true do |t| + t.integer "exim_log_done_id" + t.integer "info_request_id" + t.integer "order", :null => false + t.text "line", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "incoming_messages", :force => true do |t| t.integer "info_request_id", :null => false t.datetime "created_at", :null => false |