Index

public.chatbot_conversation_messages

Description

The messages in a conversation between a student and a chatbot.

Columns

Name Type Default Nullable Children Parents Comment
conversation_id uuid false public.chatbot_conversations The conversation this message belongs to.
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 A unique, stable identifier for the record.
is_from_chatbot boolean false If true, the message is from the chatbot. If false, the message is from the user.
message varchar(131072) true The message content.
message_is_complete boolean false false Always true for messages from the user. The chatbot messages are streamed to the client, and this field is used to indicate whether that the stream is complete.
order_number integer false The order of the message in the conversation.
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.
used_tokens integer 0 false The number of tokens used to send or receive this message.

Constraints

Name Type Definition
chatbot_conversation_messages_check CHECK CHECK (((is_from_chatbot = true) OR (message_is_complete = true)))
chatbot_conversation_messages_conversation_id_fkey FOREIGN KEY FOREIGN KEY (conversation_id) REFERENCES chatbot_conversations(id)
chatbot_conversation_messages_conversation_id_order_number__key UNIQUE UNIQUE NULLS NOT DISTINCT (conversation_id, order_number, deleted_at)
chatbot_conversation_messages_pkey PRIMARY KEY PRIMARY KEY (id)

Indexes

Name Definition
chatbot_conversation_messages_conversation_id_order_number__key CREATE UNIQUE INDEX chatbot_conversation_messages_conversation_id_order_number__key ON public.chatbot_conversation_messages USING btree (conversation_id, order_number, deleted_at) NULLS NOT DISTINCT
chatbot_conversation_messages_pkey CREATE UNIQUE INDEX chatbot_conversation_messages_pkey ON public.chatbot_conversation_messages USING btree (id)

Triggers

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

Relations

er

Generated by tbls