notifications, first approach db schema
Former-commit-id: 1142c65f175c13eaaff9b26a9887f4ef519e9612
This commit is contained in:
parent
6485de04fd
commit
dc3d7cc5e2
|
@ -1868,3 +1868,91 @@ CREATE TABLE IF NOT EXISTS `tgis_map_layer_groups` (
|
|||
FOREIGN KEY (`group_id`) REFERENCES `tgrupo` (`id_grupo`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`agent_id`) REFERENCES `tagente` (`id_agente`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnotification_source`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `url` TEXT;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `response_mode` VARCHAR(200) DEFAULT NULL;
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `citicity` INT(10) UNSIGNED DEFAULT '0';
|
||||
ALTER TABLE `tmensajes` ADD COLUMN `id_source` BIGINT(20) UNSIGNED NOT NULL;
|
||||
ALTER TABLE `tmensajes` ADD CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -719,20 +719,6 @@ CREATE TABLE IF NOT EXISTS `tlink` (
|
|||
PRIMARY KEY (`id_link`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmensajes` (
|
||||
`id_mensaje` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_usuario_origen` varchar(60) NOT NULL default '',
|
||||
`id_usuario_destino` varchar(60) NOT NULL default '',
|
||||
`mensaje` text NOT NULL,
|
||||
`timestamp` bigint (20) unsigned NOT NULL default '0',
|
||||
`subject` varchar(255) NOT NULL default '',
|
||||
`estado` int(4) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id_mensaje`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tmodule_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
@ -1177,6 +1163,93 @@ CREATE TABLE IF NOT EXISTS `treset_pass_history` (
|
|||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tnotification_source`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE `tnotification_source` (
|
||||
`id` serial,
|
||||
`description` VARCHAR(255) DEFAULT NULL,
|
||||
`icon` text,
|
||||
`max_postpone_time` int(11) DEFAULT NULL,
|
||||
`enabled` int(1) DEFAULT NULL,
|
||||
`user_editable` int(1) DEFAULT NULL,
|
||||
`also_mail` int(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tmensajes`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmensajes` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_usuario_origen` VARCHAR(60) NOT NULL DEFAULT '',
|
||||
`mensaje` TEXT NOT NULL,
|
||||
`timestamp` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`subject` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`estado` INT(4) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`url` TEXT,
|
||||
`response_mode` VARCHAR(200) DEFAULT NULL,
|
||||
`citicity` INT(10) UNSIGNED DEFAULT '0',
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`),
|
||||
UNIQUE KEY `id_mensaje` (`id_mensaje`),
|
||||
KEY `tsource_fk` (`id_source`),
|
||||
CONSTRAINT `tsource_fk` FOREIGN KEY (`id_source`) REFERENCES `tnotification_source` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_user` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60) NOT NULL,
|
||||
`utimestamp_read` BIGINT(20),
|
||||
`utimestamp_erased` BIGINT(20),
|
||||
`postpone` INT,
|
||||
PRIMARY KEY (`id_mensaje`,`id_user`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_group` (
|
||||
`id_mensaje` INT(10) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id_mensaje`,`id_group`),
|
||||
FOREIGN KEY (`id_mensaje`) REFERENCES `tmensajes`(`id_mensaje`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_user`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_user` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_user` VARCHAR(60),
|
||||
`enabled` INT(1) DEFAULT NULL,
|
||||
`also_mail` INT(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_user`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_user`) REFERENCES `tusuario`(`id_user`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnotification_source_group`
|
||||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE `tnotification_source_group` (
|
||||
`id_source` BIGINT(20) UNSIGNED NOT NULL,
|
||||
`id_group` mediumint(4) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_source`,`id_group`),
|
||||
FOREIGN KEY (`id_source`) REFERENCES `tnotification_source`(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- Table `tnews`
|
||||
-- ----------------------------------------------------------------------
|
||||
|
|
|
@ -1267,3 +1267,15 @@ INSERT INTO `tcontainer` SET `name` = 'Default graph container';
|
|||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
--
|
||||
-- Dumping data for table `tnotification_source`
|
||||
--
|
||||
INSERT INTO `tnotification_source`(`description`, `icon`, `max_postpone_time`, `user_editable`, `also_mail`) VALUES
|
||||
("System status", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Message", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Pending task", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Advertisement", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Official communication", "icono_info_mr.png", 86400, 1, 0),
|
||||
("Sugerence", "icono_info_mr.png", 86400, 1, 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue