Skip to content

translation

The text of a message key in one locale: the draft that the next release publishes and the text of the latest release that published it. The status in the API follows from the texts: no row is MISSING, only a draft is DRAFT, only a published text is PUBLISHED, both is CHANGED. Discarding a draft that was never published deletes the row. Invariant (application): the locale is one of the locales of the application of the key, and the text only uses the arguments of the key.

Name Type Default Nullable Children Parents Comment
id bigint nextval(‘translation_seq’::regclass) false
public_id uuid gen_random_uuid() false
message_key_id bigint false public.message_key
locale varchar(10) false
draft_text varchar(4000) true
published_text varchar(4000) true
published_release_id bigint true public.release The release that published the current published text; set together with published_text.
invalidated_at timestamp with time zone true When an import changed the arguments of the key so that the draft no longer matches them; such a draft is kept but not published until it is fixed. Null otherwise.
updated_by_user_id bigint false public.app_user
created_at timestamp with time zone now() false
updated_at timestamp with time zone true
version bigint false
Name Type Definition
chk_translation_locale CHECK CHECK (((locale)::text ~ ‘^[a-z]{2,3}(-[A-Z]{2})?$’::text))
chk_translation_published_release CHECK CHECK (((published_text IS NULL) = (published_release_id IS NULL)))
chk_translation_text CHECK CHECK (((draft_text IS NOT NULL) OR (published_text IS NOT NULL)))
fk_translation_updated_by_user_id FOREIGN KEY FOREIGN KEY (updated_by_user_id) REFERENCES app_user(id)
fk_translation_message_key_id FOREIGN KEY FOREIGN KEY (message_key_id) REFERENCES message_key(id)
fk_translation_published_release_id FOREIGN KEY FOREIGN KEY (published_release_id) REFERENCES release(id)
translation_pkey PRIMARY KEY PRIMARY KEY (id)
uq_translation_public_id UNIQUE UNIQUE (public_id)
uq_translation_message_key_id_locale UNIQUE UNIQUE (message_key_id, locale)
Name Definition
translation_pkey CREATE UNIQUE INDEX translation_pkey ON public.translation USING btree (id)
uq_translation_public_id CREATE UNIQUE INDEX uq_translation_public_id ON public.translation USING btree (public_id)
uq_translation_message_key_id_locale CREATE UNIQUE INDEX uq_translation_message_key_id_locale ON public.translation USING btree (message_key_id, locale)
ix_translation_published_release_id CREATE INDEX ix_translation_published_release_id ON public.translation USING btree (published_release_id)
ix_translation_updated_by_user_id CREATE INDEX ix_translation_updated_by_user_id ON public.translation USING btree (updated_by_user_id)
ix_translation_locale_message_key_id_published CREATE INDEX ix_translation_locale_message_key_id_published ON public.translation USING btree (locale, message_key_id) WHERE (published_text IS NOT NULL)

ER diagram


Generated by tbls