diff --git a/docs/db_struct.sql b/docs/db_struct.sql index 09fee3f..4587e60 100644 --- a/docs/db_struct.sql +++ b/docs/db_struct.sql @@ -88,17 +88,19 @@ CREATE TABLE `comunic_conversations_messages` ( -DROP TABLE IF EXISTS `comunic_conversations_users`; -CREATE TABLE `comunic_conversations_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `conv_id` int(11) DEFAULT NULL, - `user_id` int(11) DEFAULT NULL, - `time_add` int(11) DEFAULT NULL, - `following` int(1) DEFAULT '0', - `saw_last_message` int(1) DEFAULT NULL, +DROP TABLE IF EXISTS `comunic_conversations_members`; +CREATE TABLE `comunic_conversations_members` ( + `id` int NOT NULL AUTO_INCREMENT, + `conv_id` int DEFAULT NULL, + `user_id` int DEFAULT NULL, + `added_on` int DEFAULT NULL, + `following` int DEFAULT '0', + `is_admin` int DEFAULT '1', + `last_message_seen` int DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + DROP TABLE IF EXISTS `comunic_groups`; CREATE TABLE `comunic_groups` ( `id` int(11) NOT NULL AUTO_INCREMENT, diff --git a/docs/migration.sql b/docs/migration.sql index a2229cf..989ae21 100644 --- a/docs/migration.sql +++ b/docs/migration.sql @@ -1,4 +1,4 @@ --- Conversations table +-- Conversations messages table alter table comunic_conversations_messages rename column time_insert to time_sent; alter table comunic_conversations_messages modify message TEXT; alter table comunic_conversations_messages @@ -8,4 +8,12 @@ alter table comunic_conversations_messages add column file_thumbnail varchar(255) default null, add column file_type varchar(128) default null; update comunic_conversations_messages set filepath = image_path, file_size = 10, file_type = "image/png", file_name = "image.png" where image_path is not null and id >= 1; -alter table comunic_conversations_messages drop column image_path; \ No newline at end of file +alter table comunic_conversations_messages drop column image_path; + +-- Conversations members table +ALTER TABLE `comunic_conversations_users` RENAME TO `comunic_conversations_members` ; +ALTER TABLE comunic_conversations_members rename column time_add to added_on; +alter table comunic_conversations_members drop column saw_last_message; +alter table comunic_conversations_members + add column is_admin int default 1, + add column last_message_seen int default 0; \ No newline at end of file