diff --git a/internal/migrations/v0.10.0.go b/internal/migrations/v0.10.0.go index 12cadbe0..0ff0e483 100644 --- a/internal/migrations/v0.10.0.go +++ b/internal/migrations/v0.10.0.go @@ -25,11 +25,11 @@ func V0_10_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error { CREATE TABLE IF NOT EXISTS conversation_mentions ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), - conversation_id BIGINT REFERENCES conversations(id) ON DELETE CASCADE NOT NULL, - message_id BIGINT REFERENCES conversation_messages(id) ON DELETE CASCADE NOT NULL, - mentioned_user_id BIGINT REFERENCES users(id) ON DELETE CASCADE, - mentioned_team_id INT REFERENCES teams(id) ON DELETE CASCADE, - mentioned_by_user_id BIGINT REFERENCES users(id) ON DELETE CASCADE NOT NULL, + conversation_id BIGINT REFERENCES conversations(id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, + message_id BIGINT REFERENCES conversation_messages(id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, + mentioned_user_id BIGINT REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE, + mentioned_team_id INT REFERENCES teams(id) ON DELETE CASCADE ON UPDATE CASCADE, + mentioned_by_user_id BIGINT REFERENCES users(id) ON DELETE CASCADE ON UPDATE CASCADE NOT NULL, CONSTRAINT constraint_mention_target CHECK ( (mentioned_user_id IS NOT NULL AND mentioned_team_id IS NULL) OR (mentioned_user_id IS NULL AND mentioned_team_id IS NOT NULL) diff --git a/schema.sql b/schema.sql index 9ef255c2..1ee0a814 100644 --- a/schema.sql +++ b/schema.sql @@ -808,3 +808,23 @@ VALUES ( 'Urgent: SLA Breach for Conversation {{ .Conversation.ReferenceNumber }} for {{ .SLA.Metric }}', true ); + +INSERT INTO templates +("type", body, is_default, "name", subject, is_builtin) +VALUES ( + 'email_notification'::template_type, + '

{{ .Author.FullName }} mentioned you in a private note on conversation #{{ .Conversation.ReferenceNumber }}.

+ +

+View Conversation +

+ +

+Best regards,
+Libredesk +

', + false, + 'Mentioned in conversation', + '{{ .Author.FullName }} mentioned you in conversation #{{ .Conversation.ReferenceNumber }}', + true +);