summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-06 14:26:40 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-06 14:26:40 +0000
commitfa076fa0fb007a382ab291a16a6645d4fb9e583c (patch)
treea5d4e8e48eada0bab9e8ca9f9d2b20e42e28a771
parent29886f1d60fee7549a43cb8716a9e03e7273955a (diff)
downloadzabbix-fa076fa0fb007a382ab291a16a6645d4fb9e583c.tar.gz
zabbix-fa076fa0fb007a382ab291a16a6645d4fb9e583c.tar.xz
zabbix-fa076fa0fb007a382ab291a16a6645d4fb9e583c.zip
- removed support of action repeats (Alexei)
- fixed upgrade of rights,sysmaps,sysmaps_elements (Alexei) - fixed initial creation of user rights in data.sql (Alexei) - fixes of PostgreSQL compile (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@3875 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog6
-rw-r--r--create/data/data.sql6
-rw-r--r--create/schema/schema.sql5
-rwxr-xr-xgo3
-rw-r--r--include/db.h4
-rw-r--r--src/libs/zbxdb/db.c10
-rw-r--r--src/libs/zbxdbhigh/db.c6
-rw-r--r--src/zabbix_server/actions.c21
-rw-r--r--src/zabbix_server/alerter/alerter.c10
-rw-r--r--src/zabbix_server/events.c6
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/actions.sql4
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/alerts.sql5
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/rights.sql2
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql2
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql3
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/users.sql3
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/actions.sql4
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/alerts.sql5
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/rights.sql2
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/sysmaps.sql2
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/sysmaps_elements.sql3
-rw-r--r--upgrades/dbpatches/1.3/postgresql/patch/users.sql3
22 files changed, 50 insertions, 65 deletions
diff --git a/ChangeLog b/ChangeLog
index fc53a4e1..edb2890b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
Changes for 1.3.4:
+ - removed support of action repeats (Alexei)
+ - fixed upgrade of rights,sysmaps,sysmaps_elements (Alexei)
+ - fixed initial creation of user rights in data.sql (Alexei)
+ - fixes of PostgreSQL compile (Alexei)
+ - added icons for elements of map having Unknown status (Eugene)
- added installation check for 'BC math' (Eugene)
- - added 'UNKNOWN' status for elements of map (Eugene)
- added actions.evaltype (Alexei)
- added support of all AND, all OR and AND/OR action conditions (Alexei)
- fixed processing of Text items (Alexei)
diff --git a/create/data/data.sql b/create/data/data.sql
index 49dbfa8b..b108722d 100644
--- a/create/data/data.sql
+++ b/create/data/data.sql
@@ -55,9 +55,9 @@ INSERT INTO usrgrp VALUES (7,'Zabbix administrators');
-- Dumping data for table `rights`
--
-INSERT INTO rights VALUES (1,1,0,0,0);
-INSERT INTO rights VALUES (2,1,0,0,0);
-INSERT INTO rights VALUES (3,2,0,0,0);
+-- INSERT INTO rights VALUES (1,1,0,0,0);
+-- INSERT INTO rights VALUES (2,1,0,0,0);
+-- INSERT INTO rights VALUES (3,2,0,0,0);
--
-- Dumping data for table `hosts`
diff --git a/create/schema/schema.sql b/create/schema/schema.sql
index d62ca5ae..769ce938 100644
--- a/create/schema/schema.sql
+++ b/create/schema/schema.sql
@@ -155,10 +155,7 @@ FIELD |message |t_blob |'' |NOT NULL |ZBX_SYNC
FIELD |status |t_integer |'0' |NOT NULL |ZBX_SYNC
FIELD |retries |t_integer |'0' |NOT NULL |ZBX_SYNC
FIELD |error |t_varchar(128) |'' |NOT NULL |ZBX_SYNC
-FIELD |repeats |t_integer |'0' |NOT NULL |ZBX_SYNC
-FIELD |maxrepeats |t_integer |'0' |NOT NULL |ZBX_SYNC
FIELD |nextcheck |t_integer |'0' |NOT NULL |ZBX_SYNC
-FIELD |delay |t_integer |'0' |NOT NULL |ZBX_SYNC
INDEX |1 |actionid
INDEX |2 |clock
INDEX |3 |triggerid
@@ -236,8 +233,6 @@ FIELD |userid |t_id |'0' |NOT NULL |ZBX_SYNC
FIELD |subject |t_varchar(255) |'' |NOT NULL |ZBX_SYNC
FIELD |message |t_blob |'' |NOT NULL |ZBX_SYNC
FIELD |recipient |t_integer |'0' |NOT NULL |ZBX_SYNC
-FIELD |maxrepeats |t_integer |'0' |NOT NULL |ZBX_SYNC
-FIELD |repeatdelay |t_integer |'600' |NOT NULL |ZBX_SYNC
FIELD |source |t_integer |'0' |NOT NULL |ZBX_SYNC
FIELD |actiontype |t_integer |'0' |NOT NULL |ZBX_SYNC
FIELD |evaltype |t_integer |'0' |NOT NULL |ZBX_SYNC
diff --git a/go b/go
index 4b0f995d..ff37800f 100755
--- a/go
+++ b/go
@@ -33,7 +33,8 @@ cd -
#export CFLAGS="-Wall -pedantic"
#./configure --enable-agent --enable-server --with-libcurl --with-sqlite3 --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
#./configure --enable-agent --enable-server --with-libcurl --with-pgsql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
-./configure --enable-agent --enable-server --with-jabber --with-libcurl --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
+#./configure --enable-agent --enable-server --with-jabber --with-libcurl --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
+./configure --enable-agent --enable-server --with-jabber --with-libcurl --with-pgsql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
#./configure --enable-agent --enable-server --with-mysql --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
#./configure --enable-agent --enable-server --with-oracle=/home/zabbix/sqlora8 --with-net-snmp --prefix=`pwd` 2>>WARNINGS >/dev/null
echo Cleaning...
diff --git a/include/db.h b/include/db.h
index 990cae7d..fb2ae7e4 100644
--- a/include/db.h
+++ b/include/db.h
@@ -279,8 +279,6 @@ DB_ACTION
char *subject;
char *message;
int message_len;
- int maxrepeats;
- int repeatdelay;
char *scripts;
};
@@ -390,7 +388,7 @@ int DBadd_history_str(zbx_uint64_t itemid, char *value, int clock);
int DBadd_history_text(zbx_uint64_t itemid, char *value, int clock);
int DBadd_history_uint(zbx_uint64_t itemid, zbx_uint64_t value, int clock);
int DBadd_service_alarm(zbx_uint64_t serviceid,int status,int clock);
-int DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t userid, zbx_uint64_t mediatypeid, char *sendto, char *subject, char *message, int maxrepeats, int repeatdelay);
+int DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t triggerid, zbx_uint64_t userid, zbx_uint64_t mediatypeid, char *sendto, char *subject, char *message);
void DBupdate_triggers_status_after_restart(void);
int DBget_prev_trigger_value(zbx_uint64_t triggerid);
/*int DBupdate_trigger_value(int triggerid,int value,int clock);*/
diff --git a/src/libs/zbxdb/db.c b/src/libs/zbxdb/db.c
index add0f52b..043203a3 100644
--- a/src/libs/zbxdb/db.c
+++ b/src/libs/zbxdb/db.c
@@ -59,7 +59,7 @@ void zbx_db_close(void)
#endif
#ifdef HAVE_POSTGRESQL
PQfinish(conn);
- conn = NULL
+ conn = NULL;
#endif
#ifdef HAVE_ORACLE
sqlo_finish(oracle);
@@ -135,14 +135,16 @@ int zbx_db_connect(char *host, char *user, char *password, char *dbname, char *d
#ifdef HAVE_POSTGRESQL
/* conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName); */
/* conn = PQsetdb(NULL, NULL, NULL, NULL, CONFIG_DBNAME);*/
- conn = PQsetdbLogin(CONFIG_DBHOST, NULL, NULL, NULL, dbname, user, password );
+ conn = PQsetdbLogin(host, NULL, NULL, NULL, dbname, user, password );
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
{
zabbix_log(LOG_LEVEL_ERR, "Connection to database '%s' failed.", dbname);
- exit(FAIL);
+ ret = ZBX_DB_FAIL;
}
+
+ return ret;
#endif
#ifdef HAVE_ORACLE
char connect[MAX_STRING_LEN];
@@ -728,7 +730,7 @@ zbx_uint64_t zbx_db_insert_id(int exec_result, const char *table, const char *fi
if(exec_result == FAIL) return 0;
if((Oid)exec_result == InvalidOid) return 0;
- tmp_res = DBselect("select %s from %s where oid=%i", field, table, exec_result);
+ tmp_res = zbx_db_select("select %s from %s where oid=%i", field, table, exec_result);
ZBX_STR2UINT64(id_res, PQgetvalue(tmp_res->pg_result, 0, 0));
/* id_res = atoi(PQgetvalue(tmp_res->pg_result, 0, 0));*/
diff --git a/src/libs/zbxdbhigh/db.c b/src/libs/zbxdbhigh/db.c
index 807e2c49..8f76fa43 100644
--- a/src/libs/zbxdbhigh/db.c
+++ b/src/libs/zbxdbhigh/db.c
@@ -1193,7 +1193,7 @@ int DBget_queue_count(void)
return res;
}
-int DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t userid, zbx_uint64_t triggerid, zbx_uint64_t mediatypeid, char *sendto, char *subject, char *message, int maxrepeats, int repeatdelay)
+int DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t userid, zbx_uint64_t triggerid, zbx_uint64_t mediatypeid, char *sendto, char *subject, char *message)
{
int now;
@@ -1222,10 +1222,10 @@ int DBadd_alert(zbx_uint64_t actionid, zbx_uint64_t userid, zbx_uint64_t trigger
memset(message_esc, 0, size);
DBescape_string(message,message_esc,size);
- DBexecute("insert into alerts (alertid, actionid,triggerid,userid,clock,mediatypeid,sendto,subject,message,status,retries,maxrepeats,delay)"
+ DBexecute("insert into alerts (alertid, actionid,triggerid,userid,clock,mediatypeid,sendto,subject,message,status,retries)"
" values (" ZBX_FS_UI64 "," ZBX_FS_UI64 "," ZBX_FS_UI64 "," ZBX_FS_UI64 ",%d," ZBX_FS_UI64 ",'%s','%s','%s',0,0,%d,%d)",
DBget_maxid("alerts","alertid"),
- actionid,triggerid,userid,now,mediatypeid,sendto_esc,subject_esc,message_esc, maxrepeats, repeatdelay);
+ actionid,triggerid,userid,now,mediatypeid,sendto_esc,subject_esc,message_esc);
zbx_free(sendto_esc);
zbx_free(subject_esc);
diff --git a/src/zabbix_server/actions.c b/src/zabbix_server/actions.c
index 8670e44e..ac3b1b6a 100644
--- a/src/zabbix_server/actions.c
+++ b/src/zabbix_server/actions.c
@@ -98,7 +98,7 @@ static void send_to_user_medias(DB_EVENT *event,DB_ACTION *action, zbx_uint64_t
continue;
}
- DBadd_alert(action->actionid, userid, event->triggerid, media.mediatypeid,media.sendto,action->subject,action->message, action->maxrepeats, action->repeatdelay);
+ DBadd_alert(action->actionid, userid, event->triggerid, media.mediatypeid,media.sendto,action->subject,action->message);
}
DBfree_result(result);
@@ -347,7 +347,7 @@ static void run_commands(DB_EVENT *event, DB_ACTION *action)
{
run_remote_command(alias, command);
}
-/* DBadd_alert(action->actionid,trigger->triggerid, userid, media.mediatypeid,media.sendto,action->subject,action->scripts, action->maxrepeats, action->repeatdelay); */ /* TODO !!! Add alert for remote commands !!! */
+/* DBadd_alert(action->actionid,trigger->triggerid, userid, media.mediatypeid,media.sendto,action->subject,action->scripts); */ /* TODO !!! Add alert for remote commands !!! */
}
zabbix_log( LOG_LEVEL_DEBUG, "End run_commands()");
}
@@ -746,18 +746,12 @@ void apply_actions(DB_EVENT *event)
zabbix_log( LOG_LEVEL_DEBUG, "Applying actions");
-/* now = time(NULL);*/
-
-/* zbx_snprintf(sql,sizeof(sql),"select actionid,userid,delay,subject,message,scope,severity,recipient,good from actions where (scope=%d and triggerid=%d and good=%d and nextcheck<=%d) or (scope=%d and good=%d) or (scope=%d and good=%d)",ACTION_SCOPE_TRIGGER,trigger->triggerid,trigger_value,now,ACTION_SCOPE_HOST,trigger_value,ACTION_SCOPE_HOSTS,trigger_value);*/
-/* zbx_snprintf(sql,sizeof(sql),"select actionid,userid,delay,subject,message,recipient,maxrepeats,repeatdelay,scripts,actiontype from actions where nextcheck<=%d and status=%d", now, ACTION_STATUS_ACTIVE);*/
-
- /* No support of action delay anymore */
- result = DBselect("select actionid,userid,subject,message,recipient,maxrepeats,repeatdelay,scripts,actiontype,evaltype from actions where status=%d and" ZBX_COND_NODEID, ACTION_STATUS_ACTIVE, LOCAL_NODE("actionid"));
+ result = DBselect("select actionid,userid,subject,message,recipient,scripts,actiontype,evaltype from actions where status=%d and" ZBX_COND_NODEID, ACTION_STATUS_ACTIVE, LOCAL_NODE("actionid"));
while((row=DBfetch(result)))
{
ZBX_STR2UINT64(action.actionid, row[0]);
- action.evaltype = atoi(row[9]);
+ action.evaltype = atoi(row[7]);
if(check_action_conditions(event, &action) == SUCCEED)
{
@@ -767,12 +761,9 @@ void apply_actions(DB_EVENT *event)
action.subject = strdup(row[2]);
action.message = strdup(row[3]);
- action.scripts = strdup(row[7]);
-
action.recipient = atoi(row[4]);
- action.maxrepeats = atoi(row[5]);
- action.repeatdelay = atoi(row[6]);
- action.actiontype = atoi(row[8]);
+ action.scripts = strdup(row[5]);
+ action.actiontype = atoi(row[6]);
substitute_macros(event, &action, &action.message);
substitute_macros(event, &action, &action.subject);
diff --git a/src/zabbix_server/alerter/alerter.c b/src/zabbix_server/alerter/alerter.c
index 83f6dea6..4b53bc3d 100644
--- a/src/zabbix_server/alerter/alerter.c
+++ b/src/zabbix_server/alerter/alerter.c
@@ -90,7 +90,7 @@ int execute_action(DB_ALERT *alert,DB_MEDIATYPE *mediatype, char *error, int max
(char *)0 };
- zabbix_log( LOG_LEVEL_WARNING, "In execute_action(%s)", mediatype->smtp_server);
+ zabbix_log( LOG_LEVEL_DEBUG, "In execute_action(%s)", mediatype->smtp_server);
if(mediatype->type==ALERT_TYPE_EMAIL)
{
@@ -162,7 +162,7 @@ int execute_action(DB_ALERT *alert,DB_MEDIATYPE *mediatype, char *error, int max
res=FAIL;
}
- zabbix_log( LOG_LEVEL_WARNING, "End of execute_action()");
+ zabbix_log( LOG_LEVEL_DEBUG, "End execute_action()");
return res;
}
@@ -205,7 +205,7 @@ int main_alerter_loop()
now = time(NULL);
- result = DBselect("select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path,a.delay,mt.gsm_modem,mt.username,mt.passwd from alerts a,media_type mt where a.status=%d and a.retries<3 and (a.repeats<a.maxrepeats or a.maxrepeats=0) and a.nextcheck<=%d and a.mediatypeid=mt.mediatypeid and " ZBX_COND_NODEID " order by a.clock", ALERT_STATUS_NOT_SENT, now, LOCAL_NODE("mt.mediatypeid"));
+ result = DBselect("select a.alertid,a.mediatypeid,a.sendto,a.subject,a.message,a.status,a.retries,mt.mediatypeid,mt.type,mt.description,mt.smtp_server,mt.smtp_helo,mt.smtp_email,mt.exec_path,a.delay,mt.gsm_modem,mt.username,mt.passwd from alerts a,media_type mt where a.status=%d and a.retries<3 and a.mediatypeid=mt.mediatypeid and " ZBX_COND_NODEID " order by a.clock", ALERT_STATUS_NOT_SENT, LOCAL_NODE("mt.mediatypeid"));
while((row=DBfetch(result)))
{
@@ -245,8 +245,8 @@ int main_alerter_loop()
if(res==SUCCEED)
{
zabbix_log( LOG_LEVEL_DEBUG, "Alert ID [" ZBX_FS_UI64 "] was sent successfully", alert.alertid);
- DBexecute("update alerts set repeats=repeats+1, nextcheck=%d where alertid=" ZBX_FS_UI64, now+alert.delay, alert.alertid);
- DBexecute("update alerts set status=%d where alertid=" ZBX_FS_UI64 " and repeats>=maxrepeats and status=%d and retries<3", ALERT_STATUS_SENT, alert.alertid, ALERT_STATUS_NOT_SENT);
+ DBexecute("update alerts set status=%d where status=%d and alertid=" ZBX_FS_UI64,
+ ALERT_STATUS_SENT, ALERT_STATUS_NOT_SENT, alert.alertid);
}
else
{
diff --git a/src/zabbix_server/events.c b/src/zabbix_server/events.c
index 3b8ad518..16e609aa 100644
--- a/src/zabbix_server/events.c
+++ b/src/zabbix_server/events.c
@@ -137,11 +137,11 @@ int process_event(DB_EVENT *event)
event->eventid,event->triggerid, event->clock, event->value);
/* Cancel currently active alerts */
- if(event->value == TRIGGER_VALUE_FALSE || event->value == TRIGGER_VALUE_TRUE)
+/* if(event->value == TRIGGER_VALUE_FALSE || event->value == TRIGGER_VALUE_TRUE)
{
- DBexecute("update alerts set retries=3,error='Trigger changed its status. WIll not send repeats.' where triggerid=" ZBX_FS_UI64 " and repeats>0 and status=%d",
+ DBexecute("update alerts set retries=3,error='Trigger changed its status. Will not send repeats.' where triggerid=" ZBX_FS_UI64 " and repeats>0 and status=%d",
event->triggerid, ALERT_STATUS_NOT_SENT);
- }
+ }*/
apply_actions(event);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/actions.sql b/upgrades/dbpatches/1.3/mysql/patch/actions.sql
index cde11926..c31e23ca 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/actions.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/actions.sql
@@ -4,8 +4,6 @@ CREATE TABLE actions_tmp (
subject varchar(255) DEFAULT '' NOT NULL,
message blob DEFAULT '' NOT NULL,
recipient integer DEFAULT '0' NOT NULL,
- maxrepeats integer DEFAULT '0' NOT NULL,
- repeatdelay integer DEFAULT '600' NOT NULL,
source integer DEFAULT '0' NOT NULL,
actiontype integer DEFAULT '0' NOT NULL,
evaltype integer DEFAULT '0' NOT NULL,
@@ -14,6 +12,6 @@ CREATE TABLE actions_tmp (
PRIMARY KEY (actionid)
) ENGINE=InnoDB ;
-insert into actions_tmp select actionid,userid,subject,message,recipient,maxrepeats,repeatdelay,source,actiontype,0,status,scripts from actions;
+insert into actions_tmp select actionid,userid,subject,message,recipient,source,actiontype,0,status,scripts from actions;
drop table actions;
alter table actions_tmp rename actions;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/alerts.sql b/upgrades/dbpatches/1.3/mysql/patch/alerts.sql
index 19230ecb..79ed2860 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/alerts.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/alerts.sql
@@ -11,10 +11,7 @@ CREATE TABLE alerts_tmp (
status integer DEFAULT '0' NOT NULL,
retries integer DEFAULT '0' NOT NULL,
error varchar(128) DEFAULT '' NOT NULL,
- repeats integer DEFAULT '0' NOT NULL,
- maxrepeats integer DEFAULT '0' NOT NULL,
nextcheck integer DEFAULT '0' NOT NULL,
- delay integer DEFAULT '0' NOT NULL,
PRIMARY KEY (alertid)
) ENGINE=InnoDB ;
CREATE INDEX alerts_1 on alerts_tmp (actionid);
@@ -24,6 +21,6 @@ CREATE INDEX alerts_4 on alerts_tmp (status,retries);
CREATE INDEX alerts_5 on alerts_tmp (mediatypeid);
CREATE INDEX alerts_6 on alerts_tmp (userid);
-insert into alerts_tmp select * from alerts;
+insert into alerts_tmp select alertid,actionid,triggerid,userid,clock,mediatypeid,sendto,subject,message,status,retries,error,nextcheck from alerts;
drop table alerts;
alter table alerts_tmp rename alerts;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/rights.sql b/upgrades/dbpatches/1.3/mysql/patch/rights.sql
index d009ecf2..6d737ea9 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/rights.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/rights.sql
@@ -8,6 +8,6 @@ CREATE TABLE rights_tmp (
) ENGINE=InnoDB;
CREATE INDEX rights_1 on rights_tmp (groupid);
-insert into rights_tmp select * from rights;
+--insert into rights_tmp select * from rights;
drop table rights;
alter table rights_tmp rename rights;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql b/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql
index b357e8e8..e673e3af 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql
@@ -10,6 +10,6 @@ CREATE TABLE sysmaps_tmp (
) ENGINE=InnoDB;
CREATE INDEX sysmaps_1 on sysmaps_tmp (name);
-insert into sysmaps_tmp select * from sysmaps;
+insert into sysmaps_tmp select s.sysmapid,s.name,s.width,s.height,i.imageid,s.label_type,s.label_location from sysmaps s,images i where s.background=i.name;
drop table sysmaps;
alter table sysmaps_tmp rename sysmaps;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql b/upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql
index 4d6f8a72..d2ca2594 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql
@@ -5,6 +5,7 @@ CREATE TABLE sysmaps_elements_tmp (
elementtype integer DEFAULT '0' NOT NULL,
iconid_off bigint unsigned DEFAULT '0' NOT NULL,
iconid_on bigint unsigned DEFAULT '0' NOT NULL,
+ iconid_unknown bigint unsigned DEFAULT '0' NOT NULL,
label varchar(128) DEFAULT '' NOT NULL,
label_location integer NULL,
x integer DEFAULT '0' NOT NULL,
@@ -13,6 +14,6 @@ CREATE TABLE sysmaps_elements_tmp (
PRIMARY KEY (selementid)
) ENGINE=InnoDB;
-insert into sysmaps_elements_tmp select * from sysmaps_elements;
+insert into sysmaps_elements_tmp select s.selementid,s.sysmapid,s.elementid,s.elementtype,i1.imageid,i2.imageid,i1.imageid,s.label,s.label_location,s.x,s.y,s.url from sysmaps_elements s,images i1,images i2 where s.icon=i1.name and s.icon_on=i2.name;
drop table sysmaps_elements;
alter table sysmaps_elements_tmp rename sysmaps_elements;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/users.sql b/upgrades/dbpatches/1.3/mysql/patch/users.sql
index fcad30a5..c2a31e17 100644
--- a/upgrades/dbpatches/1.3/mysql/patch/users.sql
+++ b/upgrades/dbpatches/1.3/mysql/patch/users.sql
@@ -13,6 +13,7 @@ CREATE TABLE users_tmp (
) ENGINE=InnoDB;
CREATE INDEX users_1 on users_tmp (alias);
-insert into users_tmp select userid,alias,name,surname,passwd,url,autologout,lang,refresh,3 from users;
+insert into users_tmp select userid,alias,name,surname,passwd,url,autologout,lang,refresh,1 from users;
+update users_tmp set type=3 where name='Admin';
drop table users;
alter table users_tmp rename users;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/actions.sql b/upgrades/dbpatches/1.3/postgresql/patch/actions.sql
index 6a9c5778..ecec38df 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/actions.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/actions.sql
@@ -4,8 +4,6 @@ CREATE TABLE actions_tmp (
subject varchar(255) DEFAULT '' NOT NULL,
message text DEFAULT '' NOT NULL,
recipient integer DEFAULT '0' NOT NULL,
- maxrepeats integer DEFAULT '0' NOT NULL,
- repeatdelay integer DEFAULT '600' NOT NULL,
source integer DEFAULT '0' NOT NULL,
actiontype integer DEFAULT '0' NOT NULL,
evaltype integer DEFAULT '0' NOT NULL,
@@ -14,6 +12,6 @@ CREATE TABLE actions_tmp (
PRIMARY KEY (actionid)
);
-insert into actions_tmp select actionid,userid,subject,message,recipient,maxrepeats,repeatdelay,source,actiontype,0,status,scripts from actions;
+insert into actions_tmp select actionid,userid,subject,message,recipient,source,actiontype,0,status,scripts from actions;
drop table actions;
alter table actions_tmp rename to actions;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/alerts.sql b/upgrades/dbpatches/1.3/postgresql/patch/alerts.sql
index 70cfd8ae..413e0ed0 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/alerts.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/alerts.sql
@@ -11,10 +11,7 @@ CREATE TABLE alerts_tmp (
status integer DEFAULT '0' NOT NULL,
retries integer DEFAULT '0' NOT NULL,
error varchar(128) DEFAULT '' NOT NULL,
- repeats integer DEFAULT '0' NOT NULL,
- maxrepeats integer DEFAULT '0' NOT NULL,
nextcheck integer DEFAULT '0' NOT NULL,
- delay integer DEFAULT '0' NOT NULL,
PRIMARY KEY (alertid)
);
CREATE INDEX alerts_1 on alerts_tmp (actionid);
@@ -24,6 +21,6 @@ CREATE INDEX alerts_4 on alerts_tmp (status,retries);
CREATE INDEX alerts_5 on alerts_tmp (mediatypeid);
CREATE INDEX alerts_6 on alerts_tmp (userid);
-insert into alerts_tmp select * from alerts;
+insert into alerts_tmp select alertid,actionid,triggerid,userid,clock,mediatypeid,sendto,subject,message,status,retries,error,nextcheck from alerts;
drop table alerts;
alter table alerts_tmp rename to alerts;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/rights.sql b/upgrades/dbpatches/1.3/postgresql/patch/rights.sql
index 9f3d6abf..19d72064 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/rights.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/rights.sql
@@ -8,6 +8,6 @@ CREATE TABLE rights_tmp (
);
CREATE INDEX rights_1 on rights_tmp (groupid);
-insert into rights_tmp select rightid,groupid,type::integer,permission,id from rights;
+--insert into rights_tmp select rightid,groupid,type::integer,permission,id from rights;
drop table rights;
alter table rights_tmp rename to rights;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/sysmaps.sql b/upgrades/dbpatches/1.3/postgresql/patch/sysmaps.sql
index 7652219c..975530db 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/sysmaps.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/sysmaps.sql
@@ -10,6 +10,6 @@ CREATE TABLE sysmaps_tmp (
);
CREATE INDEX sysmaps_1 on sysmaps_tmp (name);
-insert into sysmaps_tmp select * from sysmaps;
+insert into sysmaps_tmp select s.sysmapid,s.name,s.width,s.height,i.imageid,s.label_type,s.label_location from sysmaps s,images i where s.background=i.name;
drop table sysmaps;
alter table sysmaps_tmp rename to sysmaps;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/sysmaps_elements.sql b/upgrades/dbpatches/1.3/postgresql/patch/sysmaps_elements.sql
index 97fd7a8d..97c2e847 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/sysmaps_elements.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/sysmaps_elements.sql
@@ -5,6 +5,7 @@ CREATE TABLE sysmaps_elements_tmp (
elementtype integer DEFAULT '0' NOT NULL,
iconid_off bigint DEFAULT '0' NOT NULL,
iconid_on bigint DEFAULT '0' NOT NULL,
+ iconid_unknown bigint DEFAULT '0' NOT NULL,
label varchar(128) DEFAULT '' NOT NULL,
label_location integer NULL,
x integer DEFAULT '0' NOT NULL,
@@ -13,6 +14,6 @@ CREATE TABLE sysmaps_elements_tmp (
PRIMARY KEY (selementid)
);
-insert into sysmaps_elements_tmp select * from sysmaps_elements;
+insert into sysmaps_elements_tmp select s.selementid,s.sysmapid,s.elementid,s.elementtype,i1.imageid,i2.imageid,i1.imageid,s.label,s.label_location,s.x,s.y,s.url from sysmaps_elements s,images i1,images i2 where s.icon=i1.name and s.icon_on=i2.name;
drop table sysmaps_elements;
alter table sysmaps_elements_tmp rename to sysmaps_elements;
diff --git a/upgrades/dbpatches/1.3/postgresql/patch/users.sql b/upgrades/dbpatches/1.3/postgresql/patch/users.sql
index ac094cfe..67c0bbe1 100644
--- a/upgrades/dbpatches/1.3/postgresql/patch/users.sql
+++ b/upgrades/dbpatches/1.3/postgresql/patch/users.sql
@@ -13,6 +13,7 @@ CREATE TABLE users_tmp (
);
CREATE INDEX users_1 on users_tmp (alias);
-insert into users_tmp select userid,alias,name,surname,passwd,url,autologout,lang,refresh,3 from users;
+insert into users_tmp select userid,alias,name,surname,passwd,url,autologout,lang,refresh,1 from users;
+update users_tmp set type=3 where name='Admin';
drop table users;
alter table users_tmp rename to users;