2011-04-19 Ramon Novoa <rnovoa@artica.es>

* include/functions_db.php, pandoradb.sql,
	  pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
	  extras/pandoradb_migrate_v3.2_to_v4.0.sql,
	  general/logon_ok.php, godmode/admin_access_logs.php: Several fixes to
	  make things work in MySQL, PostgreSQL and Oracle.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4254 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-04-19 16:30:53 +00:00
parent a6c3579232
commit 631ba5b006
8 changed files with 129 additions and 106 deletions

View File

@ -1,3 +1,11 @@
2011-04-19 Ramon Novoa <rnovoa@artica.es>
* include/functions_db.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_v3.2_to_v4.0.sql,
general/logon_ok.php, godmode/admin_access_logs.php: Several fixes to
make things work in MySQL, PostgreSQL and Oracle.
2011-04-19 Javier Lanz <javier.lanz@artica.es> 2011-04-19 Javier Lanz <javier.lanz@artica.es>
* godmode/modules/manage_network_components_form.php: Enabled port field * godmode/modules/manage_network_components_form.php: Enabled port field

View File

@ -79,3 +79,12 @@ ALTER TABLE `treport_content` ADD COLUMN `style` TEXT NOT NULL DEFAULT '';
-- Table `tperfil` -- Table `tperfil`
-- ----------------------------------------------------- -- -----------------------------------------------------
ALTER TABLE `tperfil` MODIFY `name` TEXT NOT NULL DEFAULT ''; ALTER TABLE `tperfil` MODIFY `name` TEXT NOT NULL DEFAULT '';
-- -----------------------------------------------------
-- Table `tsesion`
-- -----------------------------------------------------
ALTER TABLE `tsesion` CHANGE `ID_sesion` `id_sesion` bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE `tsesion` CHANGE `ID_usuario` `id_usuario` varchar(60) NOT NULL default '0';
ALTER TABLE `tsesion` CHANGE `IP_origen` `ip_origen` varchar(100) NOT NULL default '';

View File

@ -171,16 +171,16 @@ switch ($config["dbtype"]) {
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]); AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf ("SELECT \"ID_usuario\", accion, fecha, \"IP_origen\", descripcion $sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion
FROM tsesion FROM tsesion
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 604800) WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 604800)
AND \"ID_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]); AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
break; break;
case "oracle": case "oracle":
$sql = sprintf ("SELECT ID_usuario, accion, fecha, IP_origen, descripcion $sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion
FROM tsesion FROM tsesion
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - 604800) WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - 604800)
AND ID_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]); AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
break; break;
} }
@ -199,8 +199,8 @@ foreach ($sessions as $session) {
$session_ip_origen = $session['ip_origen']; $session_ip_origen = $session['ip_origen'];
break; break;
case "postgresql": case "postgresql":
$session_id_usuario = $session['ID_usuario']; $session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['IP_origen']; $session_ip_origen = $session['ip_origen'];
break; break;
} }

View File

@ -90,25 +90,25 @@ if ($tipo_log != 'all') {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
if ($user_filter != 'all') { if ($user_filter != 'all') {
$filter .= sprintf(' AND ID_usuario = "%s"', $user_filter); $filter .= sprintf(' AND id_usuario = "%s"', $user_filter);
} }
$filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")'; $filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")';
if ($filter_ip != '') { if ($filter_ip != '') {
$filter .= sprintf(' AND IP_origen LIKE "%s"', $filter_ip); $filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip);
} }
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
if ($user_filter != 'all') { if ($user_filter != 'all') {
$filter .= sprintf(' AND ID_usuario = \'%s\'', $user_filter); $filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter);
} }
$filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')'; $filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')';
if ($filter_ip != '') { if ($filter_ip != '') {
$filter .= sprintf(' AND IP_origen LIKE \'%s\'', $filter_ip); $filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip);
} }
break; break;
} }
@ -224,7 +224,7 @@ foreach ($result as $row) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$data[0] = $row["ID_usuario"]; $data[0] = $row["id_usuario"];
break; break;
case "oracle": case "oracle":
$data[0] = $row["id_usuario"]; $data[0] = $row["id_usuario"];
@ -235,7 +235,7 @@ foreach ($result as $row) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$data[3] = $row["IP_origen"]; $data[3] = $row["ip_origen"];
break; break;
case "oracle": case "oracle":
$data[3] = $row["ip_origen"]; $data[3] = $row["ip_origen"];
@ -246,7 +246,7 @@ foreach ($result as $row) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$data[5] = enterprise_hook('cell1EntepriseAudit', array($row['ID_sesion'])); $data[5] = enterprise_hook('cell1EntepriseAudit', array($row['id_sesion']));
break; break;
case "oracle": case "oracle":
$data[5] = enterprise_hook('cell1EntepriseAudit', array($row['id_sesion'])); $data[5] = enterprise_hook('cell1EntepriseAudit', array($row['id_sesion']));
@ -257,7 +257,7 @@ foreach ($result as $row) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$data[6] = enterprise_hook('cell2EntepriseAudit', array($row['ID_sesion'])); $data[6] = enterprise_hook('cell2EntepriseAudit', array($row['id_sesion']));
break; break;
case "oracle": case "oracle":
$data[6] = enterprise_hook('cell2EntepriseAudit', array($row['id_sesion'])); $data[6] = enterprise_hook('cell2EntepriseAudit', array($row['id_sesion']));
@ -271,7 +271,7 @@ foreach ($result as $row) {
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
enterprise_hook('rowEnterpriseAudit', array($table, &$iterator, $row['ID_sesion'])); enterprise_hook('rowEnterpriseAudit', array($table, &$iterator, $row['id_sesion']));
break; break;
case "oracle": case "oracle":
enterprise_hook('rowEnterpriseAudit', array($table, &$iterator, $row['id_sesion'])); enterprise_hook('rowEnterpriseAudit', array($table, &$iterator, $row['id_sesion']));

View File

@ -378,9 +378,9 @@ function pandora_audit($accion, $descripcion, $user_id = false, $ip = false, $in
$accion = safe_input($accion); $accion = safe_input($accion);
$descripcion = safe_input($descripcion); $descripcion = safe_input($descripcion);
$values = array('ID_usuario' => $id, $values = array('id_usuario' => $id,
'accion' => $accion, 'accion' => $accion,
'IP_origen' => $ip, 'ip_origen' => $ip,
'descripcion' => $descripcion, 'descripcion' => $descripcion,
'fecha' => date('Y-m-d H:i:s'), 'fecha' => date('Y-m-d H:i:s'),
'utimestamp' => time()); 'utimestamp' => time());

View File

@ -24,9 +24,12 @@
-- Pandora schema creation script -- Pandora schema creation script
-- Triggers must end with two semicolons because Pandora installer need it -- Triggers must end with two semicolons because Pandora installer need it
CREATE OR REPLACE FUNCTION UNIX_TIMESTAMP (oracletime IN DATE DEFAULT SYSDATE) RETURN INTEGER AS unixtime INTEGER; BEGIN unixtime := (oracletime - to_date('19700101','YYYYMMDD')) * 86400; RETURN unixtime; END;;
CREATE OR REPLACE FUNCTION NOW RETURN TIMESTAMP AS t_now TIMESTAMP; BEGIN SELECT LOCALTIMESTAMP INTO t_now FROM dual; RETURN t_now; END;;
CREATE TABLE taddress ( CREATE TABLE taddress (
id_a NUMBER(10, 0) NOT NULL PRIMARY KEY, id_a NUMBER(10, 0) NOT NULL PRIMARY KEY,
ip VARCHAR(60) default '' NOT NULL, ip VARCHAR(60) default '',
ip_pack NUMBER(10, 0) default 0 NOT NULL ip_pack NUMBER(10, 0) default 0 NOT NULL
); );
CREATE INDEX taddress_ip_idx ON taddress(ip); CREATE INDEX taddress_ip_idx ON taddress(ip);
@ -48,7 +51,7 @@ CREATE OR REPLACE TRIGGER taddress_agent_inc BEFORE INSERT ON taddress_agent REF
CREATE TABLE tagente ( CREATE TABLE tagente (
id_agente NUMBER(10, 0) NOT NULL PRIMARY KEY, id_agente NUMBER(10, 0) NOT NULL PRIMARY KEY,
nombre VARCHAR2(600) default '' NOT NULL, nombre VARCHAR2(600) default '',
direccion VARCHAR2(100) default NULL, direccion VARCHAR2(100) default NULL,
comentarios VARCHAR2(255) default '', comentarios VARCHAR2(255) default '',
id_grupo NUMBER(10, 0) default 0 NOT NULL, id_grupo NUMBER(10, 0) default 0 NOT NULL,
@ -124,7 +127,7 @@ CREATE OR REPLACE TRIGGER tagente_datos_log4x_inc BEFORE INSERT ON tagente_datos
CREATE TABLE tagente_estado ( CREATE TABLE tagente_estado (
id_agente_estado NUMBER(10, 0) NOT NULL PRIMARY KEY, id_agente_estado NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_agente_modulo NUMBER(10, 0) default 0 NOT NULL, id_agente_modulo NUMBER(10, 0) default 0 NOT NULL,
datos CLOB default '' NOT NULL, datos CLOB default '',
timestamp TIMESTAMP default NULL, timestamp TIMESTAMP default NULL,
estado NUMBER(10, 0) default 0 NOT NULL, estado NUMBER(10, 0) default 0 NOT NULL,
id_agente NUMBER(10, 0) default 0 NOT NULL, id_agente NUMBER(10, 0) default 0 NOT NULL,
@ -161,8 +164,8 @@ CREATE TABLE tagente_modulo (
id_agente_modulo NUMBER(10, 0) NOT NULL PRIMARY KEY, id_agente_modulo NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_agente NUMBER(10, 0) default 0 NOT NULL, id_agente NUMBER(10, 0) default 0 NOT NULL,
id_tipo_modulo NUMBER(10, 0) default 0 NOT NULL, id_tipo_modulo NUMBER(10, 0) default 0 NOT NULL,
descripcion CLOB default '' NOT NULL, descripcion CLOB default '',
nombre CLOB default '' NOT NULL, nombre CLOB default '',
id_policy_module NUMBER(10, 0) default 0 NOT NULL, id_policy_module NUMBER(10, 0) default 0 NOT NULL,
max NUMBER(19, 0) default 0 NOT NULL, max NUMBER(19, 0) default 0 NOT NULL,
min NUMBER(19, 0) default 0 NOT NULL, min NUMBER(19, 0) default 0 NOT NULL,
@ -221,14 +224,14 @@ CREATE INDEX tagent_access_utimestamp_idx ON tagent_access(utimestamp);
CREATE TABLE talert_snmp ( CREATE TABLE talert_snmp (
id_as NUMBER(10, 0) NOT NULL PRIMARY KEY, id_as NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_alert NUMBER(10, 0) default 0 NOT NULL, id_alert NUMBER(10, 0) default 0 NOT NULL,
al_field1 CLOB default '' NOT NULL, al_field1 CLOB default '',
al_field2 CLOB default '' NOT NULL, al_field2 CLOB default '',
al_field3 CLOB default '' NOT NULL, al_field3 CLOB default '',
description VARCHAR2(255) default '', description VARCHAR2(255) default '',
alert_type NUMBER(5, 0) default 0 NOT NULL, alert_type NUMBER(5, 0) default 0 NOT NULL,
agent VARCHAR2(100) default '', agent VARCHAR2(100) default '',
custom_oid VARCHAR2(200) default '', custom_oid VARCHAR2(200) default '',
oid VARCHAR2(255) default '' NOT NULL, oid VARCHAR2(255) default '',
time_threshold NUMBER(10, 0) default 0 NOT NULL, time_threshold NUMBER(10, 0) default 0 NOT NULL,
times_fired NUMBER(5, 0) default 0 NOT NULL, times_fired NUMBER(5, 0) default 0 NOT NULL,
last_fired TIMESTAMP default NULL, last_fired TIMESTAMP default NULL,
@ -244,7 +247,7 @@ CREATE OR REPLACE TRIGGER talert_snmp_inc BEFORE INSERT ON talert_snmp REFERENCI
CREATE TABLE talert_commands ( CREATE TABLE talert_commands (
id NUMBER(10, 0) NOT NULL PRIMARY KEY, id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
command CLOB default '', command CLOB default '',
description CLOB default '', description CLOB default '',
internal NUMBER(10, 0) default 0 internal NUMBER(10, 0) default 0
@ -258,7 +261,7 @@ CREATE TABLE talert_actions (
id NUMBER(10, 0) NOT NULL PRIMARY KEY, id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name CLOB default '', name CLOB default '',
id_alert_command NUMBER(10, 0) NOT NULL REFERENCES talert_commands(id) ON DELETE CASCADE, id_alert_command NUMBER(10, 0) NOT NULL REFERENCES talert_commands(id) ON DELETE CASCADE,
field1 CLOB default '' NOT NULL, field1 CLOB default '',
field2 CLOB default '', field2 CLOB default '',
field3 CLOB default '', field3 CLOB default '',
id_group NUMBER(19, 0) default 0 NOT NULL, id_group NUMBER(19, 0) default 0 NOT NULL,
@ -300,7 +303,7 @@ CREATE TABLE talert_templates (
saturday NUMBER(5, 0) default 1, saturday NUMBER(5, 0) default 1,
sunday NUMBER(5, 0) default 1, sunday NUMBER(5, 0) default 1,
recovery_notify NUMBER(5, 0) default 0, recovery_notify NUMBER(5, 0) default 0,
field2_recovery CLOB default '' NOT NULL, field2_recovery CLOB default '',
field3_recovery CLOB NOT NULL, field3_recovery CLOB NOT NULL,
priority NUMBER(10, 0) default 0 NOT NULL, priority NUMBER(10, 0) default 0 NOT NULL,
id_group NUMBER(10, 0) default 0 NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL,
@ -379,7 +382,7 @@ CREATE TABLE talert_compound (
saturday NUMBER(5, 0) default 1, saturday NUMBER(5, 0) default 1,
sunday NUMBER(5, 0) default 1, sunday NUMBER(5, 0) default 1,
recovery_notify NUMBER(5, 0) default 0, recovery_notify NUMBER(5, 0) default 0,
field2_recovery VARCHAR2(255) default '' NOT NULL, field2_recovery VARCHAR2(255) default '',
field3_recovery CLOB NOT NULL, field3_recovery CLOB NOT NULL,
internal_counter NUMBER(10, 0) default 0, internal_counter NUMBER(10, 0) default 0,
last_fired NUMBER(19, 0) default 0 NOT NULL, last_fired NUMBER(19, 0) default 0 NOT NULL,
@ -437,8 +440,8 @@ CREATE OR REPLACE TRIGGER talert_compound_action_update1 AFTER UPDATE OF ID ON t
CREATE TABLE tattachment ( CREATE TABLE tattachment (
id_attachment NUMBER(10, 0) NOT NULL PRIMARY KEY, id_attachment NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_incidencia NUMBER(10, 0) default 0 NOT NULL, id_incidencia NUMBER(10, 0) default 0 NOT NULL,
id_usuario VARCHAR2(60) default '' NOT NULL, id_usuario VARCHAR2(60) default '',
filename VARCHAR2(255) default '' NOT NULL, filename VARCHAR2(255) default '',
description VARCHAR2(150) default '', description VARCHAR2(150) default '',
"size" NUMBER(19, 0) default 0 NOT NULL "size" NUMBER(19, 0) default 0 NOT NULL
); );
@ -449,8 +452,8 @@ CREATE OR REPLACE TRIGGER tattachment_inc BEFORE INSERT ON tattachment REFERENCI
CREATE TABLE tconfig ( CREATE TABLE tconfig (
id_config NUMBER(10, 0) NOT NULL PRIMARY KEY, id_config NUMBER(10, 0) NOT NULL PRIMARY KEY,
token VARCHAR2(100) default '' NOT NULL, token VARCHAR2(100) default '',
value VARCHAR2(100) default '' NOT NULL value VARCHAR2(100) default ''
); );
CREATE SEQUENCE tconfig_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tconfig_s INCREMENT BY 1 START WITH 1;
@ -459,7 +462,7 @@ CREATE OR REPLACE TRIGGER tconfig_inc BEFORE INSERT ON tconfig REFERENCING NEW A
CREATE TABLE tconfig_os ( CREATE TABLE tconfig_os (
id_os NUMBER(10, 0) NOT NULL PRIMARY KEY, id_os NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
description VARCHAR2(250) default '', description VARCHAR2(250) default '',
icon_name VARCHAR2(100) default '' icon_name VARCHAR2(100) default ''
); );
@ -472,13 +475,13 @@ CREATE TABLE tevento (
id_grupo NUMBER(10, 0) default 0 NOT NULL, id_grupo NUMBER(10, 0) default 0 NOT NULL,
estado NUMBER(10, 0) default 0 NOT NULL, estado NUMBER(10, 0) default 0 NOT NULL,
timestamp TIMESTAMP default NULL, timestamp TIMESTAMP default NULL,
evento CLOB default '' NOT NULL, evento CLOB default '',
utimestamp NUMBER(19, 0) default 0 NOT NULL, utimestamp NUMBER(19, 0) default 0 NOT NULL,
event_type VARCHAR2(50) default 'unknown', event_type VARCHAR2(50) default 'unknown',
id_agentmodule NUMBER(10, 0) default 0 NOT NULL, id_agentmodule NUMBER(10, 0) default 0 NOT NULL,
id_alert_am NUMBER(10, 0) default 0 NOT NULL, id_alert_am NUMBER(10, 0) default 0 NOT NULL,
criticity NUMBER(10, 0) default 0 NOT NULL, criticity NUMBER(10, 0) default 0 NOT NULL,
user_comment CLOB NOT NULL, user_comment CLOB,
CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal')) CONSTRAINT tevento_event_type_cons CHECK (event_type IN ('unknown','alert_fired','alert_recovered','alert_ceased','alert_manual_validation','recon_host_detected','system','error','new_agent','going_up_warning','going_up_critical','going_down_warning','going_down_normal','going_down_critical','going_up_normal'))
); );
CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento); CREATE INDEX tevento_id_1_idx ON tevento(id_agente, id_evento);
@ -496,7 +499,7 @@ CREATE OR REPLACE TRIGGER tevento_inc BEFORE INSERT ON tevento REFERENCING NEW A
-- Criticity: 4 - Critical (red) (status 1) -- Criticity: 4 - Critical (red) (status 1)
CREATE TABLE tgrupo ( CREATE TABLE tgrupo (
id_grupo NUMBER(10, 0) NOT NULL PRIMARY KEY, id_grupo NUMBER(10, 0) NOT NULL PRIMARY KEY,
nombre CLOB default '' NOT NULL, nombre CLOB default '',
icon VARCHAR2(50) default 'world', icon VARCHAR2(50) default 'world',
parent NUMBER(10, 0) default 0 NOT NULL, parent NUMBER(10, 0) default 0 NOT NULL,
propagate NUMBER(5, 0) default 0, propagate NUMBER(5, 0) default 0,
@ -512,10 +515,10 @@ CREATE TABLE tincidencia (
id_incidencia NUMBER(19, 0) NOT NULL PRIMARY KEY, id_incidencia NUMBER(19, 0) NOT NULL PRIMARY KEY,
inicio TIMESTAMP default NULL, inicio TIMESTAMP default NULL,
cierre TIMESTAMP default NULL, cierre TIMESTAMP default NULL,
titulo CLOB default '' NOT NULL, titulo CLOB default '',
descripcion CLOB NOT NULL, descripcion CLOB NOT NULL,
id_usuario VARCHAR2(60) default '' NOT NULL, id_usuario VARCHAR2(60) default '',
origen VARCHAR2(100) default '' NOT NULL, origen VARCHAR2(100) default '',
estado NUMBER(10, 0) default 0 NOT NULL, estado NUMBER(10, 0) default 0 NOT NULL,
prioridad NUMBER(10, 0) default 0 NOT NULL, prioridad NUMBER(10, 0) default 0 NOT NULL,
id_grupo NUMBER(10, 0) default 0 NOT NULL, id_grupo NUMBER(10, 0) default 0 NOT NULL,
@ -536,14 +539,14 @@ CREATE SEQUENCE tincidencia_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER tincidencia_inc BEFORE INSERT ON tincidencia REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tincidencia_s.nextval INTO :NEW.ID_INCIDENCIA FROM dual; END;; CREATE OR REPLACE TRIGGER tincidencia_inc BEFORE INSERT ON tincidencia REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tincidencia_s.nextval INTO :NEW.ID_INCIDENCIA FROM dual; END;;
CREATE TABLE tlanguage ( CREATE TABLE tlanguage (
id_language VARCHAR2(6) default '' NOT NULL, id_language VARCHAR2(6) default '',
name VARCHAR2(100) default '' NOT NULL name VARCHAR2(100) default ''
); );
CREATE TABLE tlink ( CREATE TABLE tlink (
id_link NUMBER(10, 0) NOT NULL PRIMARY KEY, id_link NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
link VARCHAR2(255) default '' NOT NULL link VARCHAR2(255) default ''
); );
CREATE SEQUENCE tlink_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tlink_s INCREMENT BY 1 START WITH 1;
@ -552,11 +555,11 @@ CREATE OR REPLACE TRIGGER tlink_inc BEFORE INSERT ON tlink REFERENCING NEW AS NE
CREATE TABLE tmensajes ( CREATE TABLE tmensajes (
id_mensaje NUMBER(10, 0) NOT NULL PRIMARY KEY, id_mensaje NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_usuario_origen VARCHAR2(60) default '' NOT NULL, id_usuario_origen VARCHAR2(60) default '',
id_usuario_destino VARCHAR2(60) default '' NOT NULL, id_usuario_destino VARCHAR2(60) default '',
mensaje CLOB NOT NULL, mensaje CLOB NOT NULL,
timestamp NUMBER(19, 0) default 0 NOT NULL, timestamp NUMBER(19, 0) default 0 NOT NULL,
subject VARCHAR2(255) default '' NOT NULL, subject VARCHAR2(255) default '',
estado NUMBER(10, 0) default 0 NOT NULL estado NUMBER(10, 0) default 0 NOT NULL
); );
@ -566,7 +569,7 @@ CREATE OR REPLACE TRIGGER tmensajes_inc BEFORE INSERT ON tmensajes REFERENCING N
CREATE TABLE tmodule_group ( CREATE TABLE tmodule_group (
id_mg NUMBER(10, 0) NOT NULL PRIMARY KEY, id_mg NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(150) default '' NOT NULL name VARCHAR2(150) default ''
); );
CREATE SEQUENCE tmodule_group_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tmodule_group_s INCREMENT BY 1 START WITH 1;
@ -614,14 +617,14 @@ CREATE OR REPLACE TRIGGER tnetwork_component_inc BEFORE INSERT ON tnetwork_compo
CREATE TABLE tnetwork_component_group ( CREATE TABLE tnetwork_component_group (
id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY, id_sg NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(200) default '' NOT NULL, name VARCHAR2(200) default '',
parent NUMBER(19, 0) default 0 NOT NULL parent NUMBER(19, 0) default 0 NOT NULL
); );
CREATE TABLE tnetwork_profile ( CREATE TABLE tnetwork_profile (
id_np NUMBER(10, 0) NOT NULL PRIMARY KEY, id_np NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
description VARCHAR2(250) default '' description VARCHAR2(250) default ''
); );
@ -645,12 +648,12 @@ CREATE TABLE tnota (
CREATE INDEX tnota_id_incident_idx ON tnota(id_incident); CREATE INDEX tnota_id_incident_idx ON tnota(id_incident);
CREATE TABLE torigen ( CREATE TABLE torigen (
origen VARCHAR2(100) default '' NOT NULL origen VARCHAR2(100) default ''
); );
CREATE TABLE tperfil ( CREATE TABLE tperfil (
id_perfil NUMBER(10, 0) NOT NULL PRIMARY KEY, id_perfil NUMBER(10, 0) NOT NULL PRIMARY KEY,
name CLOB default '' NOT NULL, name CLOB default '',
incident_edit NUMBER(5, 0) default 0 NOT NULL, incident_edit NUMBER(5, 0) default 0 NOT NULL,
incident_view NUMBER(5, 0) default 0 NOT NULL, incident_view NUMBER(5, 0) default 0 NOT NULL,
incident_management NUMBER(5, 0) default 0 NOT NULL, incident_management NUMBER(5, 0) default 0 NOT NULL,
@ -680,9 +683,9 @@ CREATE OR REPLACE TRIGGER trecon_script_inc BEFORE INSERT ON trecon_script REFER
CREATE TABLE trecon_task ( CREATE TABLE trecon_task (
id_rt NUMBER(10, 0) NOT NULL PRIMARY KEY, id_rt NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
description VARCHAR2(250) default '' NOT NULL, description VARCHAR2(250) default '',
subnet VARCHAR2(64) default '' NOT NULL, subnet VARCHAR2(64) default '',
id_network_profile NUMBER(10, 0) default 0 NOT NULL, id_network_profile NUMBER(10, 0) default 0 NOT NULL,
create_incident NUMBER(10, 0) default 0 NOT NULL, create_incident NUMBER(10, 0) default 0 NOT NULL,
id_group NUMBER(10, 0) default 1 NOT NULL, id_group NUMBER(10, 0) default 1 NOT NULL,
@ -691,13 +694,13 @@ CREATE TABLE trecon_task (
interval_sweep NUMBER(10, 0) default 0 NOT NULL, interval_sweep NUMBER(10, 0) default 0 NOT NULL,
id_recon_server NUMBER(10, 0) default 0 NOT NULL, id_recon_server NUMBER(10, 0) default 0 NOT NULL,
id_os NUMBER(10, 0) default 0 NOT NULL, id_os NUMBER(10, 0) default 0 NOT NULL,
recon_ports VARCHAR2(250) default '' NOT NULL, recon_ports VARCHAR2(250) default '',
snmp_community VARCHAR2(64) default 'public' NOT NULL, snmp_community VARCHAR2(64) default 'public' NOT NULL,
id_recon_script NUMBER(10, 0), id_recon_script NUMBER(10, 0),
field1 VARCHAR2(250) default '' NOT NULL, field1 VARCHAR2(250) default '',
field2 VARCHAR2(250) default '' NOT NULL, field2 VARCHAR2(250) default '',
field3 VARCHAR2(250) default '' NOT NULL, field3 VARCHAR2(250) default '',
field4 VARCHAR2(250) default '' NOT NULL field4 VARCHAR2(250) default ''
); );
CREATE INDEX trecon_task_id_rec_serv_idx ON trecon_task(id_recon_server); CREATE INDEX trecon_task_id_rec_serv_idx ON trecon_task(id_recon_server);
@ -707,8 +710,8 @@ CREATE OR REPLACE TRIGGER trecon_task_inc BEFORE INSERT ON trecon_task REFERENCI
CREATE TABLE tserver ( CREATE TABLE tserver (
id_server NUMBER(10, 0) NOT NULL PRIMARY KEY, id_server NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
ip_address VARCHAR2(100) default '' NOT NULL, ip_address VARCHAR2(100) default '',
status NUMBER(10, 0) default 0 NOT NULL, status NUMBER(10, 0) default 0 NOT NULL,
laststart TIMESTAMP default NULL, laststart TIMESTAMP default NULL,
keepalive TIMESTAMP default NULL, keepalive TIMESTAMP default NULL,
@ -719,7 +722,7 @@ CREATE TABLE tserver (
checksum NUMBER(10, 0) default 0 NOT NULL, checksum NUMBER(10, 0) default 0 NOT NULL,
description VARCHAR2(255) default NULL, description VARCHAR2(255) default NULL,
recon_server NUMBER(10, 0) default 0 NOT NULL, recon_server NUMBER(10, 0) default 0 NOT NULL,
version VARCHAR2(20) default '' NOT NULL, version VARCHAR2(20) default '',
plugin_server NUMBER(10, 0) default 0 NOT NULL, plugin_server NUMBER(10, 0) default 0 NOT NULL,
prediction_server NUMBER(10, 0) default 0 NOT NULL, prediction_server NUMBER(10, 0) default 0 NOT NULL,
wmi_server NUMBER(10, 0) default 0 NOT NULL, wmi_server NUMBER(10, 0) default 0 NOT NULL,
@ -755,16 +758,16 @@ CREATE OR REPLACE TRIGGER tserver_inc BEFORE INSERT ON tserver REFERENCING NEW A
-- TODO: drop 2.x xxxx_server fields, unused since server_type exists. -- TODO: drop 2.x xxxx_server fields, unused since server_type exists.
CREATE TABLE tsesion ( CREATE TABLE tsesion (
ID_sesion NUMBER(19, 0) NOT NULL PRIMARY KEY, id_sesion NUMBER(19, 0) NOT NULL PRIMARY KEY,
ID_usuario VARCHAR2(60) default '0' NOT NULL, id_usuario VARCHAR2(60) default '0' NOT NULL,
IP_origen VARCHAR2(100) default '' NOT NULL, ip_origen VARCHAR2(100) default '',
accion VARCHAR2(100) default '' NOT NULL, accion VARCHAR2(100) default '',
descripcion CLOB default '' NOT NULL, descripcion CLOB default '',
fecha TIMESTAMP default NULL, fecha TIMESTAMP default NULL,
utimestamp NUMBER(19, 0) default 0 NOT NULL utimestamp NUMBER(19, 0) default 0 NOT NULL
); );
CREATE INDEX tsesion_utimestamp_idx ON tsesion(utimestamp); CREATE INDEX tsesion_utimestamp_idx ON tsesion(utimestamp);
CREATE INDEX tsesion_ID_usuario_idx ON tsesion(ID_usuario); CREATE INDEX tsesion_id_usuario_idx ON tsesion(id_usuario);
CREATE SEQUENCE tsesion_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tsesion_s INCREMENT BY 1 START WITH 1;
@ -772,9 +775,9 @@ CREATE OR REPLACE TRIGGER tsesion_inc BEFORE INSERT ON tsesion REFERENCING NEW A
CREATE TABLE ttipo_modulo ( CREATE TABLE ttipo_modulo (
id_tipo NUMBER(10, 0) NOT NULL PRIMARY KEY, id_tipo NUMBER(10, 0) NOT NULL PRIMARY KEY,
nombre VARCHAR2(100) default '' NOT NULL, nombre VARCHAR2(100) default '',
categoria NUMBER(10, 0) default 0 NOT NULL, categoria NUMBER(10, 0) default 0 NOT NULL,
descripcion VARCHAR2(100) default '' NOT NULL, descripcion VARCHAR2(100) default '',
icon VARCHAR2(100) default NULL icon VARCHAR2(100) default NULL
); );
@ -784,8 +787,8 @@ CREATE OR REPLACE TRIGGER ttipo_modulo_inc BEFORE INSERT ON ttipo_modulo REFEREN
CREATE TABLE ttrap ( CREATE TABLE ttrap (
id_trap NUMBER(19, 0) NOT NULL PRIMARY KEY, id_trap NUMBER(19, 0) NOT NULL PRIMARY KEY,
source VARCHAR2(50) default '' NOT NULL, source VARCHAR2(50) default '',
oid CLOB default '' NOT NULL, oid CLOB default '',
oid_custom CLOB default '', oid_custom CLOB default '',
type NUMBER(10, 0) default 0 NOT NULL, type NUMBER(10, 0) default 0 NOT NULL,
type_custom VARCHAR2(100) default '', type_custom VARCHAR2(100) default '',
@ -807,7 +810,7 @@ CREATE TABLE tusuario (
fullname VARCHAR2(255) NOT NULL, fullname VARCHAR2(255) NOT NULL,
firstname VARCHAR2(255) NOT NULL, firstname VARCHAR2(255) NOT NULL,
lastname VARCHAR2(255) NOT NULL, lastname VARCHAR2(255) NOT NULL,
middlename VARCHAR2(255) default '' NOT NULL, middlename VARCHAR2(255) default '',
password VARCHAR2(45) default NULL, password VARCHAR2(45) default NULL,
comments VARCHAR2(200) default NULL, comments VARCHAR2(200) default NULL,
last_connect NUMBER(19, 0) default 0 NOT NULL, last_connect NUMBER(19, 0) default 0 NOT NULL,
@ -823,10 +826,10 @@ CREATE TABLE tusuario (
CREATE TABLE tusuario_perfil ( CREATE TABLE tusuario_perfil (
id_up NUMBER(19, 0) NOT NULL PRIMARY KEY, id_up NUMBER(19, 0) NOT NULL PRIMARY KEY,
id_usuario VARCHAR2(100) default '' NOT NULL, id_usuario VARCHAR2(100) default '',
id_perfil NUMBER(10, 0) default 0 NOT NULL, id_perfil NUMBER(10, 0) default 0 NOT NULL,
id_grupo NUMBER(10, 0) default 0 NOT NULL, id_grupo NUMBER(10, 0) default 0 NOT NULL,
assigned_by VARCHAR2(100) default '' NOT NULL assigned_by VARCHAR2(100) default ''
); );
CREATE SEQUENCE tusuario_perfil_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tusuario_perfil_s INCREMENT BY 1 START WITH 1;
@ -835,8 +838,8 @@ CREATE OR REPLACE TRIGGER tusuario_perfil_inc BEFORE INSERT ON tusuario_perfil R
CREATE TABLE tnews ( CREATE TABLE tnews (
id_news NUMBER(10, 0) NOT NULL PRIMARY KEY, id_news NUMBER(10, 0) NOT NULL PRIMARY KEY,
author VARCHAR2(255) DEFAULT '' NOT NULL, author VARCHAR2(255) DEFAULT '',
subject VARCHAR2(255) DEFAULT '' NOT NULL, subject VARCHAR2(255) DEFAULT '',
text CLOB NOT NULL, text CLOB NOT NULL,
timestamp TIMESTAMP default NULL timestamp TIMESTAMP default NULL
); );
@ -847,8 +850,8 @@ CREATE OR REPLACE TRIGGER tnews_inc BEFORE INSERT ON tnews REFERENCING NEW AS NE
CREATE TABLE tgraph ( CREATE TABLE tgraph (
id_graph NUMBER(10, 0) NOT NULL PRIMARY KEY, id_graph NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '' NOT NULL, id_user VARCHAR2(100) default '',
name VARCHAR2(150) default '' NOT NULL, name VARCHAR2(150) default '',
description CLOB NOT NULL, description CLOB NOT NULL,
period NUMBER(10, 0) default 0 NOT NULL, period NUMBER(10, 0) default 0 NOT NULL,
width NUMBER(10, 0) default 0 NOT NULL, width NUMBER(10, 0) default 0 NOT NULL,
@ -876,8 +879,8 @@ CREATE OR REPLACE TRIGGER tgraph_source_inc BEFORE INSERT ON tgraph_source REFER
CREATE TABLE treport ( CREATE TABLE treport (
id_report NUMBER(10, 0) NOT NULL PRIMARY KEY, id_report NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_user VARCHAR2(100) default '' NOT NULL, id_user VARCHAR2(100) default '',
name VARCHAR2(150) default '' NOT NULL, name VARCHAR2(150) default '',
description CLOB NOT NULL, description CLOB NOT NULL,
private NUMBER(5, 0) default 0 NOT NULL, private NUMBER(5, 0) default 0 NOT NULL,
id_group NUMBER(19, 0) default 0 NOT NULL, id_group NUMBER(19, 0) default 0 NOT NULL,
@ -931,7 +934,7 @@ CREATE TABLE treport_content (
order_uptodown NUMBER(10, 0) default 0 NOT NULL, order_uptodown NUMBER(10, 0) default 0 NOT NULL,
show_graph NUMBER(10, 0) default 0 NOT NULL, show_graph NUMBER(10, 0) default 0 NOT NULL,
group_by_agent NUMBER(10, 0) default 0 NOT NULL, group_by_agent NUMBER(10, 0) default 0 NOT NULL,
style CLOB default '' NOT NULL, style CLOB default '',
id_group NUMBER(10, 0) default 0 NOT NULL, id_group NUMBER(10, 0) default 0 NOT NULL,
id_module_group NUMBER(10, 0) default 0 NOT NULL id_module_group NUMBER(10, 0) default 0 NOT NULL
); );
@ -975,7 +978,7 @@ CREATE OR REPLACE TRIGGER treport_content_item_inc BEFORE INSERT ON treport_cont
CREATE TABLE treport_custom_sql ( CREATE TABLE treport_custom_sql (
id NUMBER(10, 0) NOT NULL PRIMARY KEY, id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(150) default '' NOT NULL, name VARCHAR2(150) default '',
sql CLOB default NULL sql CLOB default NULL
); );
@ -1039,7 +1042,7 @@ CREATE OR REPLACE TRIGGER tplugin_inc BEFORE INSERT ON tplugin REFERENCING NEW A
CREATE TABLE tmodule ( CREATE TABLE tmodule (
id_module NUMBER(10, 0) NOT NULL PRIMARY KEY, id_module NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL name VARCHAR2(100) default ''
); );
CREATE SEQUENCE tmodule_s INCREMENT BY 1 START WITH 1; CREATE SEQUENCE tmodule_s INCREMENT BY 1 START WITH 1;
@ -1048,17 +1051,17 @@ CREATE OR REPLACE TRIGGER tmodule_inc BEFORE INSERT ON tmodule REFERENCING NEW A
CREATE TABLE tserver_export ( CREATE TABLE tserver_export (
id NUMBER(10, 0) NOT NULL PRIMARY KEY, id NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(100) default '' NOT NULL, name VARCHAR2(100) default '',
preffix VARCHAR2(100) default '' NOT NULL, preffix VARCHAR2(100) default '',
interval NUMBER(10, 0) default 300 NOT NULL, interval NUMBER(10, 0) default 300 NOT NULL,
ip_server VARCHAR2(100) default '' NOT NULL, ip_server VARCHAR2(100) default '',
connect_mode VARCHAR2(20) default 'local', connect_mode VARCHAR2(20) default 'local',
id_export_server NUMBER(10, 0) default NULL , id_export_server NUMBER(10, 0) default NULL ,
"user" VARCHAR2(100) default '' NOT NULL, "user" VARCHAR2(100) default '',
pass VARCHAR2(100) default '' NOT NULL, pass VARCHAR2(100) default '',
port NUMBER(10, 0) default 0 NOT NULL, port NUMBER(10, 0) default 0 NOT NULL,
directory VARCHAR2(100) default '' NOT NULL, directory VARCHAR2(100) default '',
options VARCHAR2(100) default '' NOT NULL, options VARCHAR2(100) default '',
--Number of hours of diference with the server timezone --Number of hours of diference with the server timezone
timezone_offset NUMBER(5, 0) default 0 NOT NULL, timezone_offset NUMBER(5, 0) default 0 NOT NULL,
CONSTRAINT tserver_export_conn_mode_cons CHECK (connect_mode IN ('tentacle', 'ssh', 'local')) CONSTRAINT tserver_export_conn_mode_cons CHECK (connect_mode IN ('tentacle', 'ssh', 'local'))
@ -1073,9 +1076,9 @@ CREATE OR REPLACE TRIGGER tserver_export_inc BEFORE INSERT ON tserver_export REF
CREATE TABLE tserver_export_data ( CREATE TABLE tserver_export_data (
id NUMBER(10, 0) NOT NULL PRIMARY KEY, id NUMBER(10, 0) NOT NULL PRIMARY KEY,
id_export_server NUMBER(10, 0) default 0 NOT NULL, id_export_server NUMBER(10, 0) default 0 NOT NULL,
agent_name VARCHAR2(100) default '' NOT NULL, agent_name VARCHAR2(100) default '',
module_name VARCHAR2(100) default '' NOT NULL, module_name VARCHAR2(100) default '',
module_type VARCHAR2(100) default '' NOT NULL, module_type VARCHAR2(100) default '',
data VARCHAR2(255) default NULL, data VARCHAR2(255) default NULL,
timestamp TIMESTAMP default NULL timestamp TIMESTAMP default NULL
); );
@ -1370,7 +1373,7 @@ CREATE OR REPLACE TRIGGER tsnmp_filter_inc BEFORE INSERT ON tsnmp_filter REFEREN
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE tagent_custom_fields ( CREATE TABLE tagent_custom_fields (
id_field NUMBER(10, 0) NOT NULL PRIMARY KEY, id_field NUMBER(10, 0) NOT NULL PRIMARY KEY,
name VARCHAR2(45) default '' NOT NULL, name VARCHAR2(45) default '',
display_on_front NUMBER(5, 0) default 0 NOT NULL display_on_front NUMBER(5, 0) default 0 NOT NULL
); );

View File

@ -610,16 +610,16 @@ CREATE INDEX "tserver_status_idx" ON "tserver"("status");
-- TODO: drop 2.x xxxx_server fields, unused since server_type exists. -- TODO: drop 2.x xxxx_server fields, unused since server_type exists.
CREATE TABLE "tsesion" ( CREATE TABLE "tsesion" (
"ID_sesion" BIGSERIAL NOT NULL PRIMARY KEY, "id_sesion" BIGSERIAL NOT NULL PRIMARY KEY,
"ID_usuario" varchar(60) NOT NULL default '0', "id_usuario" varchar(60) NOT NULL default '0',
"IP_origen" varchar(100) NOT NULL default '', "ip_origen" varchar(100) NOT NULL default '',
"accion" varchar(100) NOT NULL default '', "accion" varchar(100) NOT NULL default '',
"descripcion" text NOT NULL default '', "descripcion" text NOT NULL default '',
"fecha" TIMESTAMP without time zone default NULL, "fecha" TIMESTAMP without time zone default NULL,
"utimestamp" BIGINT NOT NULL default 0 "utimestamp" BIGINT NOT NULL default 0
); );
CREATE INDEX "tsesion_utimestamp_idx" ON "tsesion"("utimestamp"); CREATE INDEX "tsesion_utimestamp_idx" ON "tsesion"("utimestamp");
CREATE INDEX "tsesion_ID_usuario_idx" ON "tsesion"("ID_usuario"); CREATE INDEX "tsesion_id_usuario_idx" ON "tsesion"("id_usuario");
CREATE TABLE "ttipo_modulo" ( CREATE TABLE "ttipo_modulo" (
"id_tipo" SERIAL NOT NULL PRIMARY KEY, "id_tipo" SERIAL NOT NULL PRIMARY KEY,

View File

@ -668,17 +668,20 @@ CREATE TABLE IF NOT EXISTS `tserver` (
-- 9 web -- 9 web
-- TODO: drop 2.x xxxx_server fields, unused since server_type exists. -- TODO: drop 2.x xxxx_server fields, unused since server_type exists.
alter table spacetime change `id_sesion` bigint(20) unsigned NOT NULL auto_increment,
`id_usuario` varchar(60) NOT NULL default '0',
`ip_origen` varchar(100) NOT NULL default '',
CREATE TABLE IF NOT EXISTS `tsesion` ( CREATE TABLE IF NOT EXISTS `tsesion` (
`ID_sesion` bigint(20) unsigned NOT NULL auto_increment, `id_sesion` bigint(20) unsigned NOT NULL auto_increment,
`ID_usuario` varchar(60) NOT NULL default '0', `id_usuario` varchar(60) NOT NULL default '0',
`IP_origen` varchar(100) NOT NULL default '', `ip_origen` varchar(100) NOT NULL default '',
`accion` varchar(100) NOT NULL default '', `accion` varchar(100) NOT NULL default '',
`descripcion` text NOT NULL default '', `descripcion` text NOT NULL default '',
`fecha` datetime NOT NULL default '0000-00-00 00:00:00', `fecha` datetime NOT NULL default '0000-00-00 00:00:00',
`utimestamp` bigint(20) unsigned NOT NULL default '0', `utimestamp` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`ID_sesion`), PRIMARY KEY (`id_sesion`),
KEY `idx_utimestamp` (`utimestamp`), KEY `idx_utimestamp` (`utimestamp`),
KEY `idx_user` (`ID_usuario`) KEY `idx_user` (`id_usuario`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;