From 2d3e888321baeae889c7c51f2312aafba1ec70d0 Mon Sep 17 00:00:00 2001
From: Runxi Yu <me@runxiyu.org>
Date: Wed, 19 Feb 2025 01:02:33 +0800
Subject: contrib: Add contrib/MR index page

---
 schema.sql | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 1797466..ee32bd6 100644
--- a/schema.sql
+++ b/schema.sql
@@ -64,15 +64,17 @@ CREATE TABLE sessions (
 	UNIQUE(user_id, session_id)
 );
 
+// TODO: 
 CREATE TABLE merge_requests (
 	id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
+	title TEXT NOT NULL,
 	repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
-	creator INTEGER REFERENCES users(id) ON DELETE SET NULL,
+	creator INTEGER NOT NULL REFERENCES users(id) ON DELETE SET NULL,
 	source_ref TEXT NOT NULL,
 	destination_branch TEXT NOT NULL,
 	status TEXT NOT NULL CHECK (status IN ('open', 'merged', 'closed')),
-	created_at TIMESTAMP NOT NULL,
-	mailing_list_id INT UNIQUE REFERENCES mailing_lists(id) ON DELETE CASCADE
+	UNIQUE (repo_id, source_ref, destination_branch),
+	UNIQUE (repo_id, id)
 );
 
 CREATE TABLE user_group_roles (
-- 
cgit v1.2.3

