Index

public.email_layouts

Description

The HTML shells outgoing emails’ HTML parts are wrapped in, one live row per language at most. An email gets the row matching its language exactly, else the one matching its primary subtag (fi for fi-FI), else the row without a language, else the default shell bundled in the code. The plain-text part is never wrapped. Picked up by the sender on its next batch, so replacing a row needs no restart.

Columns

Name Type Default Nullable Children Parents Comment
button_background_color text ‘#1F6964’::text false Button background as #RRGGBB, written inline into each button, because Outlook desktop and clients that strip <style> ignore the shell’s CSS for it.
button_text_color text ‘#FFFFFF’::text false Button label colour as #RRGGBB, written inline like button_background_color.
created_at timestamp with time zone now() false Timestamp when the record was created.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
html text false A complete HTML document. {{CONTENT}} is replaced with the rendered email body, which is already HTML; {{SUBJECT}}, {{PREHEADER}} (the first paragraph as text, for the inbox preview) and {{LANGUAGE}} (the template’s or its course’s language tag, empty when unknown) with HTML-escaped values. Email clients ignore most external CSS, so styles should be inline or in a <style> element.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
language text true BCP 47 tag of the emails this shell is for, matched case-insensitively against the template’s or its course’s language. Null for the fallback shell used when no row matches.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.

Constraints

Name Type Definition
email_layouts_button_background_color_check CHECK CHECK ((button_background_color ~ ‘^#[0-9A-Fa-f]{6}$'::text)) | | email_layouts_button_background_color_not_null | n | NOT NULL button_background_color | | email_layouts_button_text_color_check | CHECK | CHECK ((button_text_color ~ '^#[0-9A-Fa-f]{6}$’::text))
email_layouts_button_text_color_not_null n NOT NULL button_text_color
email_layouts_created_at_not_null n NOT NULL created_at
email_layouts_html_check CHECK CHECK ((strpos(html, ‘{{CONTENT}}’::text) > 0))
email_layouts_html_not_null n NOT NULL html
email_layouts_id_not_null n NOT NULL id
email_layouts_language_check CHECK CHECK ((language ~ ’1{2,3}(-[A-Za-z0-9]{1,8})*$’::text))
email_layouts_pkey PRIMARY KEY PRIMARY KEY (id)
email_layouts_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
email_layouts_pkey CREATE UNIQUE INDEX email_layouts_pkey ON public.email_layouts USING btree (id)
uq_email_layouts_live_language CREATE UNIQUE INDEX uq_email_layouts_live_language ON public.email_layouts USING btree (lower(language)) NULLS NOT DISTINCT WHERE (deleted_at IS NULL)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.email_layouts FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls


  1. A-Za-z↩︎