From f99343fea8c72a2284d4617b03f32c3042c0c19e Mon Sep 17 00:00:00 2001 From: Keiran Date: Wed, 6 Aug 2025 06:30:39 +0100 Subject: [PATCH] update schema for termails --- internal/db/schema.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/db/schema.sql b/internal/db/schema.sql index 5ce66d9..f2423a5 100644 --- a/internal/db/schema.sql +++ b/internal/db/schema.sql @@ -16,10 +16,16 @@ CREATE TABLE verification_codes ( created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); -CREATE TABLE messages ( +CREATE TABLE termails ( id SERIAL PRIMARY KEY, sender_id INT REFERENCES users(id), receiver_id INT REFERENCES users(id), + subject VARCHAR(255) NOT NULL, content TEXT NOT NULL, + is_read BOOLEAN DEFAULT FALSE, sent_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP ); + +CREATE INDEX idx_termails_receiver_id ON termails(receiver_id); +CREATE INDEX idx_termails_sender_id ON termails(sender_id); +CREATE INDEX idx_termails_sent_at ON termails(sent_at);