2021-02-13 11:24:07 +00:00
|
|
|
-- Remove deprecated tables
|
|
|
|
DROP TABLE IF EXISTS `comunic_api_limit_count`;
|
|
|
|
DROP TABLE IF EXISTS `comunic_api_users_tokens`;
|
|
|
|
DROP TABLE IF EXISTS `comunic_api_services_tokens`;
|
|
|
|
DROP TABLE IF EXISTS `comunic_calls_members`;
|
2021-02-13 13:37:15 +00:00
|
|
|
DROP TABLE IF EXISTS `comunic_calls`;
|
|
|
|
|
|
|
|
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',
|
2021-02-13 15:01:44 +00:00
|
|
|
`default_expiration_time` INT DEFAULT 2592000 COMMENT '2592000 = 1 month',
|
2021-02-13 13:37:15 +00:00
|
|
|
PRIMARY KEY (`ID`));
|
|
|
|
|
|
|
|
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,
|
2021-02-13 15:46:28 +00:00
|
|
|
PRIMARY KEY (`id`));
|
|
|
|
|
|
|
|
-- Insert official API clients
|
|
|
|
INSERT INTO comunic_clients (name, domain) VALUES ('ComunicWEB', "communiquons.org");
|
|
|
|
INSERT INTO comunic_clients (name) VALUES ('ComunicAndroid');
|
|
|
|
INSERT INTO comunic_clients (name) VALUES ('ComunicFlutter');
|
|
|
|
INSERT INTO comunic_clients (name) VALUES ('ComunicWatcher');
|