Index

public.user_marketing_consents

Description

This table is used to keep a record if a user has given a marketing consent to a course

Columns

Name Type Default Nullable Children Parents Comment
consent boolean false Whether the user has given a marketing consent for a specific course.
course_id uuid false public.courses Course that the user has access to.
course_language_group_id uuid false public.course_language_groups The course language group id that the mailing list is related to
created_at timestamp with time zone now() false Timestamp of 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.
email_subscription_in_mailchimp varchar(255) true Tells the users email subscription status in Mailchimp
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
synced_to_mailchimp_at timestamp with time zone true Timestamp when the record was synced to mailchimp. If null, the record has not been synced.
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.
user_id uuid false public.users User who has the access to the course.
user_mailchimp_id varchar(255) true Unique id for the user, provided by Mailchimp

Constraints

Name Type Definition
course_language_group_specific_marketing_user_uniqueness UNIQUE UNIQUE NULLS NOT DISTINCT (user_id, course_language_group_id)
user_marketing_consents_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
user_marketing_consents_course_language_group_id_fkey FOREIGN KEY FOREIGN KEY (course_language_group_id) REFERENCES course_language_groups(id)
user_marketing_consents_pkey PRIMARY KEY PRIMARY KEY (id)
user_marketing_consents_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)

Indexes

Name Definition
course_language_group_specific_marketing_user_uniqueness CREATE UNIQUE INDEX course_language_group_specific_marketing_user_uniqueness ON public.user_marketing_consents USING btree (user_id, course_language_group_id) NULLS NOT DISTINCT
user_marketing_consents_pkey CREATE UNIQUE INDEX user_marketing_consents_pkey ON public.user_marketing_consents USING btree (id)

Triggers

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

Relations

er

Generated by tbls