aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-02-08 17:24:35 +0300
committerFrederick Muriuki Muriithi2023-02-08 17:44:50 +0300
commit9b94ec57c504acb6ef815d134144c4c357c71f17 (patch)
tree3bf1647953956e6abada8344fabeb87ef526e731 /migrations
parent87586bd5270140bf52d39d3dc61c754dd13d4391 (diff)
downloadgenenetwork3-9b94ec57c504acb6ef815d134144c4c357c71f17.tar.gz
auth: groups: handle join requests.
Diffstat (limited to 'migrations')
-rw-r--r--migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py (renamed from migrations/auth/20230207_01_r0bkZ-create-group-requests-table.py)9
1 files changed, 5 insertions, 4 deletions
diff --git a/migrations/auth/20230207_01_r0bkZ-create-group-requests-table.py b/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py
index d2cf786..6b06a64 100644
--- a/migrations/auth/20230207_01_r0bkZ-create-group-requests-table.py
+++ b/migrations/auth/20230207_01_r0bkZ-create-group-join-requests-table.py
@@ -9,19 +9,20 @@ __depends__ = {'20230116_01_KwuJ3-rework-privileges-schema'}
steps = [
step(
"""
- CREATE TABLE IF NOT EXISTS group_requests(
+ CREATE TABLE IF NOT EXISTS group_join_requests(
request_id TEXT NOT NULL,
group_id TEXT NOT NULL,
requester_id TEXT NOT NULL,
- request_type TEXT NOT NULL,
timestamp REAL NOT NULL,
+ status TEXT NOT NULL DEFAULT 'PENDING',
message TEXT,
PRIMARY KEY(request_id, group_id),
FOREIGN KEY(group_id) REFERENCES groups(group_id)
ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (requester_id) REFERENCES users(user_id)
- ON UPDATE CASCADE ON DELETE CASCADE
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ CHECK (status IN ('PENDING', 'ACCEPTED', 'REJECTED'))
) WITHOUT ROWID
""",
- "DROP TABLE IF EXISTS group_requests")
+ "DROP TABLE IF EXISTS group_join_requests")
]