Index

public.chatbot_conversations

Description

Grops the messages in a conversation between a student and a chatbot.

Columns

Name Type Default Nullable Children Parents Comment
anonymous_token varchar(255) true
chatbot_configuration_id uuid false public.chatbot_configurations The chatbot configuration that is used in this conversation.
course_id uuid true public.courses The course this chatbot is appearing on
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.
id uuid uuid_generate_v4() false public.chatbot_conversation_messages public.chatbot_conversation_messages_citations A unique, stable identifier for the record.
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 true The user that is participating in the conversation.

Constraints

Name Type Definition
chatbot_conversations_chatbot_configuration_id_fkey FOREIGN KEY FOREIGN KEY (chatbot_configuration_id) REFERENCES chatbot_configurations(id)
chatbot_conversations_chatbot_configuration_id_not_null n NOT NULL chatbot_configuration_id
chatbot_conversations_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
chatbot_conversations_created_at_not_null n NOT NULL created_at
chatbot_conversations_id_not_null n NOT NULL id
chatbot_conversations_pkey PRIMARY KEY PRIMARY KEY (id)
chatbot_conversations_updated_at_not_null n NOT NULL updated_at
user_id_or_anonymous_token_set CHECK CHECK (((user_id IS NULL) <> (anonymous_token IS NULL)))

Indexes

Name Definition
chatbot_conversations_config_anonymous_token_created_at_idx CREATE INDEX chatbot_conversations_config_anonymous_token_created_at_idx ON public.chatbot_conversations USING btree (chatbot_configuration_id, anonymous_token, created_at DESC) WHERE (deleted_at IS NULL)
chatbot_conversations_config_user_created_at_idx CREATE INDEX chatbot_conversations_config_user_created_at_idx ON public.chatbot_conversations USING btree (chatbot_configuration_id, user_id, created_at DESC) WHERE (deleted_at IS NULL)
chatbot_conversations_pkey CREATE UNIQUE INDEX chatbot_conversations_pkey ON public.chatbot_conversations USING btree (id)

Triggers

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

Relations

er

Generated by tbls