Private
Public Access
1
0

kordophone-db: adds support for the Messages table

This commit is contained in:
2025-01-20 22:05:34 -08:00
parent a8104c379c
commit 146fac2759
11 changed files with 444 additions and 28 deletions

View File

@@ -0,0 +1,6 @@
-- This file should undo anything in `up.sql`
DROP TABLE IF EXISTS `conversation_participants`;
DROP TABLE IF EXISTS `messages`;
DROP TABLE IF EXISTS `conversation_messages`;
DROP TABLE IF EXISTS `participants`;
DROP TABLE IF EXISTS `conversations`;

View File

@@ -0,0 +1,34 @@
-- Your SQL goes here
CREATE TABLE `conversation_participants`(
`conversation_id` TEXT NOT NULL,
`participant_id` INTEGER NOT NULL,
PRIMARY KEY(`conversation_id`, `participant_id`)
);
CREATE TABLE `messages`(
`id` TEXT NOT NULL PRIMARY KEY,
`text` TEXT NOT NULL,
`sender_participant_id` INTEGER,
`date` TIMESTAMP NOT NULL
);
CREATE TABLE `conversation_messages`(
`conversation_id` TEXT NOT NULL,
`message_id` TEXT NOT NULL,
PRIMARY KEY(`conversation_id`, `message_id`)
);
CREATE TABLE `participants`(
`id` INTEGER NOT NULL PRIMARY KEY,
`display_name` TEXT,
`is_me` BOOL NOT NULL
);
CREATE TABLE `conversations`(
`id` TEXT NOT NULL PRIMARY KEY,
`unread_count` BIGINT NOT NULL,
`display_name` TEXT,
`last_message_preview` TEXT,
`date` TIMESTAMP NOT NULL
);