update schema for termails

This commit is contained in:
Keiran 2025-08-06 06:30:39 +01:00
parent b2c7dcae83
commit f99343fea8

View File

@ -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);