Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions crates/defguard_mail/src/mail_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub(crate) struct MailContext {
language_tag: String,
/// Text to be replaced.
pub(crate) text: String,
#[allow(unused)]
enabled: bool,
}

impl MailContext {
Expand All @@ -19,7 +21,7 @@ impl MailContext {
// E: PgExecutor<'e>,
// {
// query_scalar!(
// "INSERT INTO mail_context (template, section, language_tag, text) \
// "INSERT INTO mail_context (template, section, language_tag, text, enabled) \
// VALUES ($1, $2, $3, $4) \
// ON CONFLICT ON CONSTRAINT template_section_language DO \
// UPDATE SET text = $4",
Expand All @@ -44,8 +46,8 @@ impl MailContext {
{
query_as!(
Self,
"SELECT template, section, language_tag, text FROM mail_context \
WHERE template = $1 AND language_tag = $2",
"SELECT template, section, language_tag, text, enabled FROM mail_context \
WHERE template = $1 AND language_tag = $2 AND enabled",
template,
language_tag
)
Expand Down
3 changes: 3 additions & 0 deletions migrations/20260223075953_[2.0.0]_mjml_part_2.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE mail_context
DROP COLUMN enabled,
ADD CONSTRAINT template_section_language UNIQUE (template, section, language_tag);
3 changes: 3 additions & 0 deletions migrations/20260223075953_[2.0.0]_mjml_part_2.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE mail_context
ADD COLUMN enabled BOOL NOT NULL DEFAULT true,
DROP CONSTRAINT template_section_language;
Loading