kordophone-db: adds support for the Messages table
This commit is contained in:
@@ -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`;
|
||||
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user