Add 'core/' from commit 'b0dfc4146ca0da535a87f8509aec68817fb2ab14'
git-subtree-dir: core git-subtree-mainline:a07f3dcd23git-subtree-split:b0dfc4146c
This commit is contained in:
0
core/kordophone-db/migrations/.keep
Normal file
0
core/kordophone-db/migrations/.keep
Normal file
@@ -0,0 +1,7 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE IF EXISTS `messages`;
|
||||
DROP TABLE IF EXISTS `conversation_messages`;
|
||||
DROP TABLE IF EXISTS `settings`;
|
||||
DROP TABLE IF EXISTS `conversations`;
|
||||
DROP TABLE IF EXISTS `participants`;
|
||||
DROP TABLE IF EXISTS `conversation_participants`;
|
||||
@@ -0,0 +1,46 @@
|
||||
-- Your SQL goes here
|
||||
CREATE TABLE `messages`(
|
||||
`id` TEXT NOT NULL PRIMARY KEY,
|
||||
`text` TEXT NOT NULL,
|
||||
`sender_participant_handle` TEXT,
|
||||
`date` TIMESTAMP NOT NULL,
|
||||
`file_transfer_guids` TEXT,
|
||||
`attachment_metadata` TEXT,
|
||||
FOREIGN KEY (`sender_participant_handle`) REFERENCES `participants`(`handle`)
|
||||
);
|
||||
|
||||
CREATE TABLE `conversation_messages`(
|
||||
`conversation_id` TEXT NOT NULL,
|
||||
`message_id` TEXT NOT NULL,
|
||||
PRIMARY KEY(`conversation_id`, `message_id`),
|
||||
FOREIGN KEY (`conversation_id`) REFERENCES `conversations`(`id`),
|
||||
FOREIGN KEY (`message_id`) REFERENCES `messages`(`id`)
|
||||
);
|
||||
|
||||
CREATE TABLE `settings`(
|
||||
`key` TEXT NOT NULL PRIMARY KEY,
|
||||
`value` BINARY 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
|
||||
);
|
||||
|
||||
CREATE TABLE `participants`(
|
||||
`handle` TEXT NOT NULL PRIMARY KEY,
|
||||
`is_me` BOOL NOT NULL,
|
||||
`contact_id` TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE `conversation_participants`(
|
||||
`conversation_id` TEXT NOT NULL,
|
||||
`participant_handle` TEXT NOT NULL,
|
||||
PRIMARY KEY(`conversation_id`, `participant_handle`),
|
||||
FOREIGN KEY (`conversation_id`) REFERENCES `conversations`(`id`),
|
||||
FOREIGN KEY (`participant_handle`) REFERENCES `participants`(`handle`)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user