This repository has been archived by the owner on May 27, 2022. It is now read-only.
forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Add more columns to outbound EmailLog (discourse#13449)
This adds the following columns to EmailLog: * cc_addresses * cc_user_ids * topic_id * raw This is to bring the EmailLog table closer in parity to IncomingEmail so it can be better utilized for Group SMTP and IMAP mailing. The raw column contains the full content of the outbound email, but _only_ if the new hidden site setting enable_raw_outbound_email_logging is enabled. Most sites do not need it, and it's mostly required for IMAP and SMTP sending. In the next pull request, there will be a migration to backfill topic_id on the EmailLog table, at which point we can remove the topic fallback method on EmailLog.
- Loading branch information
1 parent
c3e4389
commit 5222247
Showing
5 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
db/migrate/20210621002201_add_columns_to_email_log_to_match_incoming_for_smtp_imap.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddColumnsToEmailLogToMatchIncomingForSmtpImap < ActiveRecord::Migration[6.1] | ||
def up | ||
add_column :email_logs, :cc_addresses, :text, null: true | ||
add_column :email_logs, :cc_user_ids, :integer, array: true, null: true | ||
add_column :email_logs, :raw, :text, null: true | ||
add_column :email_logs, :topic_id, :integer, null: true | ||
|
||
add_index :email_logs, :topic_id, where: 'topic_id IS NOT NULL' | ||
end | ||
|
||
def down | ||
remove_column :email_logs, :cc_addresses if column_exists?(:email_logs, :cc_addresses) | ||
remove_column :email_logs, :cc_user_ids if column_exists?(:email_logs, :cc_user_ids) | ||
remove_column :email_logs, :raw if column_exists?(:email_logs, :raw) | ||
remove_column :email_logs, :topic_id if column_exists?(:email_logs, :topic_id) | ||
|
||
remove_index :email_logs, :topic_id if index_exists?(:email_logs, [:topic_id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters