diff --git a/docs/db_struct.sql b/docs/db_struct.sql index c61734d..1c36014 100644 --- a/docs/db_struct.sql +++ b/docs/db_struct.sql @@ -41,23 +41,29 @@ CREATE TABLE `commentaires` ( DROP TABLE IF EXISTS `comunic_clients`; CREATE TABLE `comunic_clients` ( - `id` INT NOT NULL AUTO_INCREMENT, - `name` VARCHAR(45) NOT NULL, - `domain` VARCHAR(45) NULL COMMENT 'Use to check Referer & define Access-Control-Allow-Origin', - `comment` VARCHAR(45) NULL COMMENT 'Information about the client', - `default_expiration_time` INT DEFAULT 2592000 COMMENT '2592000 = 1 month', - PRIMARY KEY (`ID`)); + `id` int NOT NULL AUTO_INCREMENT, + `name` varchar(45) NOT NULL, + `domain` varchar(45) DEFAULT NULL COMMENT 'Use to check Referer & define Access-Control-Allow-Origin', + `comment` varchar(45) DEFAULT NULL COMMENT 'Information about the client', + `default_expiration_time` int DEFAULT '2592000' COMMENT '2592000 = 1 month', + `firebase_token` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + DROP TABLE IF EXISTS `comunic_user_access_tokens`; CREATE TABLE `comunic_user_access_tokens` ( - `id` INT NOT NULL AUTO_INCREMENT, - `client_id` INT NOT NULL, - `user_id` INT NOT NULL, - `token` VARCHAR(255) NOT NULL, - `last_refresh` INT NOT NULL, - `timeout` INT NOT NULL, - PRIMARY KEY (`id`)); + `id` int NOT NULL AUTO_INCREMENT, + `client_id` int NOT NULL, + `token` varchar(255) NOT NULL, + `user_id` int DEFAULT NULL, + `last_refresh` int NOT NULL, + `timeout` int NOT NULL, + `push_notifications_token` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + DROP TABLE IF EXISTS `comunic_conversations_list`; CREATE TABLE `comunic_conversations_list` ( diff --git a/docs/migration.sql b/docs/migration.sql index 746a760..78c4aa5 100644 --- a/docs/migration.sql +++ b/docs/migration.sql @@ -3,3 +3,11 @@ ALTER TABLE `utilisateurs` ADD COLUMN `allow_notif_conv` INT NULL DEFAULT 1 AFTER `delete_likes_after`; ALTER TABLE `utilisateurs` ADD COLUMN `allow_notif_sound` INT NULL DEFAULT 1 AFTER `allow_notif_conv`; + +-- Clients table +ALTER TABLE `comunic_clients` + ADD COLUMN `firebase_token` VARCHAR(255) NULL AFTER `default_expiration_time`; + +-- Tokens table +ALTER TABLE `comunic_user_access_tokens` + ADD COLUMN `push_notifications_token` TEXT NULL AFTER `timeout`;