2024-08-07 10:34:24 +03:00
|
|
|
CREATE TABLE IF NOT EXISTS users (
|
2024-08-03 03:48:20 +03:00
|
|
|
mx_id VARCHAR(64),
|
|
|
|
room_id VARCHAR(64) UNIQUE,
|
|
|
|
name VARCHAR(32) DEFAULT NULL,
|
|
|
|
age SMALLINT DEFAULT NULL,
|
2024-08-05 21:21:43 +03:00
|
|
|
sex CHAR, -- 'm' of 'f'
|
|
|
|
interest CHAR, -- male, female or both ('m', 'f' and 'b')
|
2024-08-03 03:48:20 +03:00
|
|
|
description VARCHAR(512) DEFAULT NULL,
|
|
|
|
country VARCHAR(64) DEFAULT NULL,
|
|
|
|
city VARCHAR(64) DEFAULT NULL,
|
|
|
|
current_action VARCHAR(16) DEFAULT NULL,
|
2024-08-07 10:34:24 +03:00
|
|
|
currently_viewing VARCHAR(64) --link to "room_id"
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS likes (
|
|
|
|
sender VARCHAR(64), -- link to room_id
|
|
|
|
recipient VARCHAR(64), -- link to room_id
|
|
|
|
read BOOLEAN DEFAULT FALSE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS unique_likes ON likes(sender, recipient) ;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS media (
|
|
|
|
owner VARCHAR(64), -- link to room_id,
|
|
|
|
type CHAR, -- 'i' for image, 'v' for video
|
|
|
|
purpose CHAR, -- 'p' for media in profile, 'm' for media in message
|
|
|
|
url VARCHAR(64) -- mxc://......
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS messages (
|
|
|
|
sender VARCHAR(64), -- link to room_id
|
|
|
|
recipient VARCHAR(64), -- link to room_id
|
|
|
|
type CHAR, -- 't' for text, 'p' for picture and 'v' for video
|
|
|
|
content VARCHAR(128) -- will contain a url if media and text if the message is just a text
|
2024-08-03 03:48:20 +03:00
|
|
|
);
|