Skip to content

Commit 6af155f

Browse files
fix: add constraint on status
Signed-off-by: Baptiste Bronsin <baptiste.bronsin@outlook.com>
1 parent 8f549d4 commit 6af155f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core/migrations/20251107091121_create_friend_requests_table.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CREATE TABLE friend_requests (
33
user_id_requested UUID NOT NULL,
44
user_id_invited UUID NOT NULL,
5-
status SMALLINT DEFAULT 0 NOT NULL,
5+
status SMALLINT DEFAULT 0 NOT NULL CHECK (status IN (0, 1)), -- 0: pending, 1: declined
66
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
77
PRIMARY KEY (user_id_requested, user_id_invited)
88
);

0 commit comments

Comments
 (0)