summaryrefslogtreecommitdiffstats
path: root/upgrades/dbpatches/1.3
diff options
context:
space:
mode:
Diffstat (limited to 'upgrades/dbpatches/1.3')
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/acknowledges.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/actions.sql16
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/alarms.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/alerts.sql27
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/applications.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/auditlog.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/autoreg.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/conditions.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/config.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/functions.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/graphs.sql14
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/graphs_items.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/groups.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/help_items.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/history.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/history_log.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/history_str.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/history_text.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/history_uint.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/hosts.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/hosts_groups.sql5
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/hosts_profiles.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/hosts_templates.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/housekeeper.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/images.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/items.sql44
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/items_applications.sql5
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/mappings.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/media.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/media_type.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/profiles.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/rights.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/screens.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/screens_items.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/service_alarms.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/services.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/services_links.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/sessions6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/sessions.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/sysmaps.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/sysmaps_elements.sql14
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/sysmaps_links.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/trends.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/trigger_depends.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/triggers.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/users.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/users_groups.sql5
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/usrgrp.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.1/valuemaps.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/acknowledges.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/actions.sql14
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/alerts.sql25
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/applications.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/auditlog.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/autoreg.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/conditions.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/config.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/events.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/functions.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/graphs.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/graphs_items.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/groups.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/help_items.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_log.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_str.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_str_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_text.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_uint.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/history_uint_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/hosts.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/hosts_groups.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/hosts_profiles.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/hosts_templates.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/housekeeper.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/httpstep.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/httpstepitem.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/httptest.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/httptestitem.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/images.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/items.sql39
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/items_applications.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/mappings.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/media.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/media_type.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/node_cksum.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/node_configlog.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/nodes.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/profiles.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/rights.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/screens.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/screens_items.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/service_alarms.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/services.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/services_links.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/services_times.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/sessions.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/sysmaps.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/sysmaps_elements.sql14
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/sysmaps_links.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/trends.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/trigger_depends.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/triggers.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/users.sql14
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/users_groups.sql7
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/usrgrp.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/1.3/valuemaps.sql6
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/acknowledges.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/actions.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/alerts.sql29
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/applications.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/auditlog.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/autoreg.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/conditions.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/config.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/events.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/functions.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/graphs.sql19
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/graphs_items.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/groups.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/help_items.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_log.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_str.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_str_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_text.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_uint.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/history_uint_sync.sql9
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/hosts.sql19
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/hosts_groups.sql24
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/hosts_profiles.sql19
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/hosts_templates.sql23
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/housekeeper.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/httpstep.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/httpstepitem.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/httptest.sql17
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/httptestitem.sql8
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/images.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/items.sql43
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/items_applications.sql23
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/mappings.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/media.sql16
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/media_type.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/node_cksum.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/node_configlog.sql12
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/nodes.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/profiles.sql27
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/rights.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/screens.sql11
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/screens_items.sql45
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/service_alarms.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/services.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/services_links.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/services_times.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sessions.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql15
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/sysmaps_links.sql16
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/trends.sql13
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/trigger_depends.sql25
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/triggers.sql21
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/users.sql18
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/users_groups.sql23
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/usrgrp.sql10
-rw-r--r--upgrades/dbpatches/1.3/mysql/patch/valuemaps.sql10
167 files changed, 2087 insertions, 0 deletions
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/acknowledges.sql b/upgrades/dbpatches/1.3/mysql/1.1/acknowledges.sql
new file mode 100644
index 00000000..cab807f0
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/acknowledges.sql
@@ -0,0 +1,11 @@
+CREATE TABLE acknowledges (
+ acknowledgeid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ alarmid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ message varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (acknowledgeid),
+ KEY userid (userid),
+ KEY alarmid (alarmid),
+ KEY clock (clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/actions.sql b/upgrades/dbpatches/1.3/mysql/1.1/actions.sql
new file mode 100644
index 00000000..fa4cecfb
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/actions.sql
@@ -0,0 +1,16 @@
+CREATE TABLE actions (
+ actionid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+--delay int(4) DEFAULT '0' NOT NULL,
+ subject varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
+--nextcheck int(4) DEFAULT '0' NOT NULL,
+ recipient int(1) DEFAULT '0' NOT NULL,
+ maxrepeats int(4) DEFAULT '0' NOT NULL,
+ repeatdelay int(4) DEFAULT '600' NOT NULL,
+ source int(1) DEFAULT '0' NOT NULL,
+ actiontype int(1) DEFAULT '0' NOT NULL,
+ status int(1) DEFAULT '0' NOT NULL,
+ scripts blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (actionid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/alarms.sql b/upgrades/dbpatches/1.3/mysql/1.1/alarms.sql
new file mode 100644
index 00000000..fa221683
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/alarms.sql
@@ -0,0 +1,10 @@
+CREATE TABLE alarms (
+ alarmid int(4) NOT NULL auto_increment,
+ triggerid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value int(4) DEFAULT '0' NOT NULL,
+ acknowledged int(1) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (alarmid),
+ KEY (triggerid,clock),
+ KEY (clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/alerts.sql b/upgrades/dbpatches/1.3/mysql/1.1/alerts.sql
new file mode 100644
index 00000000..9908f446
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/alerts.sql
@@ -0,0 +1,27 @@
+CREATE TABLE alerts (
+ alertid int(4) NOT NULL auto_increment,
+ actionid int(4) DEFAULT '0' NOT NULL,
+ triggerid int(4) DEFAULT '0' NOT NULL,
+ userid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+-- type varchar(10) DEFAULT '' NOT NULL,
+ mediatypeid int(4) DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ subject varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
+ status int(4) DEFAULT '0' NOT NULL,
+ retries int(4) DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ repeats int(4) DEFAULT '0' NOT NULL,
+ maxrepeats int(4) DEFAULT '0' NOT NULL,
+ nextcheck int(4) DEFAULT '0' NOT NULL,
+ delay int(4) DEFAULT '0' NOT NULL,
+
+ PRIMARY KEY (alertid),
+ INDEX (actionid),
+ KEY clock (clock),
+ KEY triggerid (triggerid),
+ KEY status_retries (status, retries),
+ KEY mediatypeid (mediatypeid),
+ KEY userid (userid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/applications.sql b/upgrades/dbpatches/1.3/mysql/1.1/applications.sql
new file mode 100644
index 00000000..71d21452
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/applications.sql
@@ -0,0 +1,9 @@
+CREATE TABLE applications (
+ applicationid int(4) NOT NULL auto_increment,
+ hostid int(4) DEFAULT '0' NOT NULL,
+ name varchar(255) DEFAULT '' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (applicationid),
+ KEY templateid (templateid),
+ UNIQUE appname (hostid,name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/auditlog.sql b/upgrades/dbpatches/1.3/mysql/1.1/auditlog.sql
new file mode 100644
index 00000000..ee44c575
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/auditlog.sql
@@ -0,0 +1,11 @@
+CREATE TABLE auditlog (
+ auditid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ action int(4) DEFAULT '0' NOT NULL,
+ resourcetype int(4) DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid),
+ KEY (userid,clock),
+ KEY (clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/autoreg.sql b/upgrades/dbpatches/1.3/mysql/1.1/autoreg.sql
new file mode 100644
index 00000000..d5e2a2fc
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/autoreg.sql
@@ -0,0 +1,7 @@
+CREATE TABLE autoreg (
+ id int(4) NOT NULL auto_increment,
+ priority int(4) DEFAULT '0' NOT NULL,
+ pattern varchar(255) DEFAULT '' NOT NULL,
+ hostid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/conditions.sql b/upgrades/dbpatches/1.3/mysql/1.1/conditions.sql
new file mode 100644
index 00000000..04f74815
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/conditions.sql
@@ -0,0 +1,9 @@
+CREATE TABLE conditions (
+ conditionid int(4) NOT NULL auto_increment,
+ actionid int(4) DEFAULT '0' NOT NULL,
+ conditiontype int(4) DEFAULT '0' NOT NULL,
+ operator int(1) DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (conditionid),
+ KEY (actionid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/config.sql b/upgrades/dbpatches/1.3/mysql/1.1/config.sql
new file mode 100644
index 00000000..61a8d3e7
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/config.sql
@@ -0,0 +1,10 @@
+CREATE TABLE config (
+-- smtp_server varchar(255) DEFAULT '' NOT NULL,
+-- smtp_helo varchar(255) DEFAULT '' NOT NULL,
+-- smtp_email varchar(255) DEFAULT '' NOT NULL,
+-- password_required int(1) DEFAULT '0' NOT NULL,
+ alert_history int(4) DEFAULT '0' NOT NULL,
+ alarm_history int(4) DEFAULT '0' NOT NULL,
+ refresh_unsupported int(4) DEFAULT '0' NOT NULL,
+ work_period varchar(100) DEFAULT '1-5,00:00-24:00' NOT NULL
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/functions.sql b/upgrades/dbpatches/1.3/mysql/1.1/functions.sql
new file mode 100644
index 00000000..f61712e8
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/functions.sql
@@ -0,0 +1,11 @@
+CREATE TABLE functions (
+ functionid int(4) NOT NULL auto_increment,
+ itemid int(4) DEFAULT '0' NOT NULL,
+ triggerid int(4) DEFAULT '0' NOT NULL,
+ lastvalue varchar(255),
+ function varchar(12) DEFAULT '' NOT NULL,
+ parameter varchar(255) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (functionid),
+ KEY triggerid (triggerid),
+ KEY itemidfunctionparameter (itemid,function,parameter)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/graphs.sql b/upgrades/dbpatches/1.3/mysql/1.1/graphs.sql
new file mode 100644
index 00000000..cf733eda
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/graphs.sql
@@ -0,0 +1,14 @@
+CREATE TABLE graphs (
+ graphid int(4) NOT NULL auto_increment,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width int(4) DEFAULT '0' NOT NULL,
+ height int(4) DEFAULT '0' NOT NULL,
+ yaxistype int(1) DEFAULT '0' NOT NULL,
+ yaxismin double(16,4) DEFAULT '0' NOT NULL,
+ yaxismax double(16,4) DEFAULT '0' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ show_work_period int(1) DEFAULT '1' NOT NULL,
+ show_triggers int(1) DEFAULT '1' NOT NULL,
+ PRIMARY KEY (graphid),
+ KEY (name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/graphs_items.sql b/upgrades/dbpatches/1.3/mysql/1.1/graphs_items.sql
new file mode 100644
index 00000000..7b46d3f6
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/graphs_items.sql
@@ -0,0 +1,13 @@
+CREATE TABLE graphs_items (
+ gitemid int(4) NOT NULL auto_increment,
+ graphid int(4) DEFAULT '0' NOT NULL,
+ itemid int(4) DEFAULT '0' NOT NULL,
+ drawtype int(4) DEFAULT '0' NOT NULL,
+ sortorder int(4) DEFAULT '0' NOT NULL,
+ color varchar(32) DEFAULT 'Dark Green' NOT NULL,
+ yaxisside int(1) DEFAULT '1' NOT NULL,
+ calc_fnc int(1) DEFAULT '2' NOT NULL,
+ type int(1) DEFAULT '0' NOT NULL,
+ periods_cnt int(4) DEFAULT '5' NOT NULL,
+ PRIMARY KEY (gitemid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/groups.sql b/upgrades/dbpatches/1.3/mysql/1.1/groups.sql
new file mode 100644
index 00000000..d932908a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/groups.sql
@@ -0,0 +1,6 @@
+CREATE TABLE groups (
+ groupid int(4) NOT NULL auto_increment,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (groupid),
+ UNIQUE (name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/help_items.sql b/upgrades/dbpatches/1.3/mysql/1.1/help_items.sql
new file mode 100644
index 00000000..4057b63e
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/help_items.sql
@@ -0,0 +1,7 @@
+CREATE TABLE help_items (
+ itemtype int(4) DEFAULT '0' NOT NULL,
+ key_ varchar(64) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemtype, key_)
+) type=InnoDB;
+
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/history.sql b/upgrades/dbpatches/1.3/mysql/1.1/history.sql
new file mode 100644
index 00000000..74616774
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/history.sql
@@ -0,0 +1,7 @@
+CREATE TABLE history (
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value double(16,4) DEFAULT '0.0000' NOT NULL,
+-- PRIMARY KEY (itemid,clock)
+ KEY itemidclock (itemid, clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/history_log.sql b/upgrades/dbpatches/1.3/mysql/1.1/history_log.sql
new file mode 100644
index 00000000..a313fc3a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/history_log.sql
@@ -0,0 +1,11 @@
+CREATE TABLE history_log (
+ id int(4) NOT NULL auto_increment,
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ timestamp int(4) DEFAULT '0' NOT NULL,
+ source varchar(64) DEFAULT '' NOT NULL,
+ severity int(4) DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id),
+ KEY itemidclock (itemid, clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/history_str.sql b/upgrades/dbpatches/1.3/mysql/1.1/history_str.sql
new file mode 100644
index 00000000..95cc3ef3
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/history_str.sql
@@ -0,0 +1,7 @@
+CREATE TABLE history_str (
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+-- PRIMARY KEY (itemid,clock)
+ KEY itemidclock (itemid, clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/history_text.sql b/upgrades/dbpatches/1.3/mysql/1.1/history_text.sql
new file mode 100644
index 00000000..9b33c088
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/history_text.sql
@@ -0,0 +1,8 @@
+CREATE TABLE history_text (
+ id int(4) NOT NULL auto_increment,
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id),
+ KEY itemidclock (itemid, clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/history_uint.sql b/upgrades/dbpatches/1.3/mysql/1.1/history_uint.sql
new file mode 100644
index 00000000..96fa75f2
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/history_uint.sql
@@ -0,0 +1,7 @@
+CREATE TABLE history_uint (
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value bigint unsigned DEFAULT '0' NOT NULL,
+-- PRIMARY KEY (itemid,clock)
+ KEY itemidclock (itemid, clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/hosts.sql b/upgrades/dbpatches/1.3/mysql/1.1/hosts.sql
new file mode 100644
index 00000000..b3d96a7d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/hosts.sql
@@ -0,0 +1,17 @@
+CREATE TABLE hosts (
+ hostid int(4) NOT NULL auto_increment,
+ host varchar(64) DEFAULT '' NOT NULL,
+ useip int(1) DEFAULT '1' NOT NULL,
+ ip varchar(15) DEFAULT '127.0.0.1' NOT NULL,
+ port int(4) DEFAULT '0' NOT NULL,
+ status int(4) DEFAULT '0' NOT NULL,
+-- If status=UNREACHABLE, host will not be checked until this time
+ disable_until int(4) DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ available int(4) DEFAULT '0' NOT NULL,
+ errors_from int(4) DEFAULT '0' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostid),
+ UNIQUE (host),
+ KEY (status)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/hosts_groups.sql b/upgrades/dbpatches/1.3/mysql/1.1/hosts_groups.sql
new file mode 100644
index 00000000..2ee65f3c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/hosts_groups.sql
@@ -0,0 +1,5 @@
+CREATE TABLE hosts_groups (
+ hostid int(4) DEFAULT '0' NOT NULL,
+ groupid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostid,groupid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/hosts_profiles.sql b/upgrades/dbpatches/1.3/mysql/1.1/hosts_profiles.sql
new file mode 100644
index 00000000..31bfb1a1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/hosts_profiles.sql
@@ -0,0 +1,15 @@
+CREATE TABLE hosts_profiles (
+ hostid int(4) DEFAULT '0' NOT NULL,
+ devicetype varchar(64) DEFAULT '' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ os varchar(64) DEFAULT '' NOT NULL,
+ serialno varchar(64) DEFAULT '' NOT NULL,
+ tag varchar(64) DEFAULT '' NOT NULL,
+ macaddress varchar(64) DEFAULT '' NOT NULL,
+ hardware blob DEFAULT '' NOT NULL,
+ software blob DEFAULT '' NOT NULL,
+ contact blob DEFAULT '' NOT NULL,
+ location blob DEFAULT '' NOT NULL,
+ notes blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (hostid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/hosts_templates.sql b/upgrades/dbpatches/1.3/mysql/1.1/hosts_templates.sql
new file mode 100644
index 00000000..49229629
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/hosts_templates.sql
@@ -0,0 +1,10 @@
+CREATE TABLE hosts_templates (
+ hosttemplateid int(4) NOT NULL auto_increment,
+ hostid int(4) DEFAULT '0' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ items int(1) DEFAULT '0' NOT NULL,
+ triggers int(1) DEFAULT '0' NOT NULL,
+ graphs int(1) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hosttemplateid),
+ UNIQUE (hostid, templateid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/housekeeper.sql b/upgrades/dbpatches/1.3/mysql/1.1/housekeeper.sql
new file mode 100644
index 00000000..63cd7f1c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/housekeeper.sql
@@ -0,0 +1,7 @@
+CREATE TABLE housekeeper (
+ housekeeperid int(4) NOT NULL auto_increment,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ field varchar(64) DEFAULT '' NOT NULL,
+ value int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (housekeeperid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/images.sql b/upgrades/dbpatches/1.3/mysql/1.1/images.sql
new file mode 100644
index 00000000..72f43710
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/images.sql
@@ -0,0 +1,8 @@
+CREATE TABLE images (
+ imageid int(4) NOT NULL auto_increment,
+ imagetype int(4) DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '0' NOT NULL,
+ image longblob DEFAULT '' NOT NULL,
+ PRIMARY KEY (imageid),
+ UNIQUE (imagetype, name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/items.sql b/upgrades/dbpatches/1.3/mysql/1.1/items.sql
new file mode 100644
index 00000000..a07dfef6
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/items.sql
@@ -0,0 +1,44 @@
+CREATE TABLE items (
+ itemid int(4) NOT NULL auto_increment,
+ type int(4) DEFAULT '0' NOT NULL,
+ snmp_community varchar(64) DEFAULT '' NOT NULL,
+ snmp_oid varchar(255) DEFAULT '' NOT NULL,
+ snmp_port int(4) DEFAULT '161' NOT NULL,
+ hostid int(4) NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ key_ varchar(64) DEFAULT '' NOT NULL,
+ delay int(4) DEFAULT '0' NOT NULL,
+ history int(4) DEFAULT '90' NOT NULL,
+ trends int(4) DEFAULT '365' NOT NULL,
+-- lastdelete is not longer required
+-- lastdelete int(4) DEFAULT '0' NOT NULL,
+ nextcheck int(4) DEFAULT '0' NOT NULL,
+ lastvalue varchar(255) DEFAULT NULL,
+ lastclock int(4) DEFAULT NULL,
+ prevvalue varchar(255) DEFAULT NULL,
+ status int(4) DEFAULT '0' NOT NULL,
+ value_type int(4) DEFAULT '0' NOT NULL,
+ trapper_hosts varchar(255) DEFAULT '' NOT NULL,
+ units varchar(10) DEFAULT '' NOT NULL,
+ multiplier int(4) DEFAULT '0' NOT NULL,
+ delta int(1) DEFAULT '0' NOT NULL,
+ prevorgvalue double(16,4) DEFAULT NULL,
+ snmpv3_securityname varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_securitylevel int(1) DEFAULT '0' NOT NULL,
+ snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL,
+
+ formula varchar(255) DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+
+ lastlogsize int(4) DEFAULT '0' NOT NULL,
+ logtimefmt varchar(64) DEFAULT '' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ valuemapid int(4) DEFAULT '0' NOT NULL,
+
+ PRIMARY KEY (itemid),
+ UNIQUE shortname (hostid,key_),
+-- KEY (hostid),
+ KEY (nextcheck),
+ KEY (status)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/items_applications.sql b/upgrades/dbpatches/1.3/mysql/1.1/items_applications.sql
new file mode 100644
index 00000000..0fcd00f4
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/items_applications.sql
@@ -0,0 +1,5 @@
+CREATE TABLE items_applications (
+ applicationid int(4) DEFAULT '0' NOT NULL,
+ itemid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (applicationid,itemid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/mappings.sql b/upgrades/dbpatches/1.3/mysql/1.1/mappings.sql
new file mode 100644
index 00000000..98f140a7
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/mappings.sql
@@ -0,0 +1,8 @@
+CREATE TABLE mappings (
+ mappingid int(4) NOT NULL auto_increment,
+ valuemapid int(4) DEFAULT '0' NOT NULL,
+ value varchar(64) DEFAULT '' NOT NULL,
+ newvalue varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mappingid),
+ KEY valuemapid (valuemapid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/media.sql b/upgrades/dbpatches/1.3/mysql/1.1/media.sql
new file mode 100644
index 00000000..d800ad65
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/media.sql
@@ -0,0 +1,13 @@
+CREATE TABLE media (
+ mediaid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+-- type varchar(10) DEFAULT '' NOT NULL,
+ mediatypeid int(4) DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ active int(4) DEFAULT '0' NOT NULL,
+ severity int(4) DEFAULT '63' NOT NULL,
+ period varchar(100) DEFAULT '1-7,00:00-23:59' NOT NULL,
+ PRIMARY KEY (mediaid),
+ KEY (userid),
+ KEY (mediatypeid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/media_type.sql b/upgrades/dbpatches/1.3/mysql/1.1/media_type.sql
new file mode 100644
index 00000000..fddb2ed7
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/media_type.sql
@@ -0,0 +1,11 @@
+CREATE TABLE media_type (
+ mediatypeid int(4) NOT NULL auto_increment,
+ type int(4) DEFAULT '0' NOT NULL,
+ description varchar(100) DEFAULT '' NOT NULL,
+ smtp_server varchar(255) DEFAULT '' NOT NULL,
+ smtp_helo varchar(255) DEFAULT '' NOT NULL,
+ smtp_email varchar(255) DEFAULT '' NOT NULL,
+ exec_path varchar(255) DEFAULT '' NOT NULL,
+ gsm_modem varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mediatypeid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/profiles.sql b/upgrades/dbpatches/1.3/mysql/1.1/profiles.sql
new file mode 100644
index 00000000..f72ba7d1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/profiles.sql
@@ -0,0 +1,10 @@
+CREATE TABLE profiles (
+ profileid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ idx varchar(64) DEFAULT '' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ valuetype int(4) DEFAULT 0 NOT NULL,
+ PRIMARY KEY (profileid),
+-- KEY (userid),
+ UNIQUE (userid,idx)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/rights.sql b/upgrades/dbpatches/1.3/mysql/1.1/rights.sql
new file mode 100644
index 00000000..34795fac
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/rights.sql
@@ -0,0 +1,9 @@
+CREATE TABLE rights (
+ rightid int(4) NOT NULL auto_increment,
+ userid int(4) DEFAULT '0' NOT NULL,
+ name char(255) DEFAULT '' NOT NULL,
+ permission char(1) DEFAULT '' NOT NULL,
+ id int(4),
+ PRIMARY KEY (rightid),
+ KEY (userid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/screens.sql b/upgrades/dbpatches/1.3/mysql/1.1/screens.sql
new file mode 100644
index 00000000..d49bff30
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/screens.sql
@@ -0,0 +1,7 @@
+CREATE TABLE screens (
+ screenid int(4) NOT NULL auto_increment,
+ name varchar(255) DEFAULT 'Screen' NOT NULL,
+ hsize int(4) DEFAULT '1' NOT NULL,
+ vsize int(4) DEFAULT '1' NOT NULL,
+ PRIMARY KEY (screenid)
+) TYPE=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/screens_items.sql b/upgrades/dbpatches/1.3/mysql/1.1/screens_items.sql
new file mode 100644
index 00000000..469f58c1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/screens_items.sql
@@ -0,0 +1,18 @@
+CREATE TABLE screens_items (
+ screenitemid int(4) NOT NULL auto_increment,
+ screenid int(4) DEFAULT '0' NOT NULL,
+ resourcetype int(4) DEFAULT '0' NOT NULL,
+ resourceid int(4) DEFAULT '0' NOT NULL,
+ width int(4) DEFAULT '320' NOT NULL,
+ height int(4) DEFAULT '200' NOT NULL,
+ x int(4) DEFAULT '0' NOT NULL,
+ y int(4) DEFAULT '0' NOT NULL,
+ colspan int(4) DEFAULT '0' NOT NULL,
+ rowspan int(4) DEFAULT '0' NOT NULL,
+ elements int(4) DEFAULT '25' NOT NULL,
+ valign int(2) DEFAULT '0' NOT NULL,
+ halign int(2) DEFAULT '0' NOT NULL,
+ style int(4) DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (screenitemid)
+) TYPE=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/service_alarms.sql b/upgrades/dbpatches/1.3/mysql/1.1/service_alarms.sql
new file mode 100644
index 00000000..e66e0c20
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/service_alarms.sql
@@ -0,0 +1,9 @@
+CREATE TABLE service_alarms (
+ servicealarmid int(4) NOT NULL auto_increment,
+ serviceid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ value int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (servicealarmid),
+ KEY (serviceid,clock),
+ KEY (clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/services.sql b/upgrades/dbpatches/1.3/mysql/1.1/services.sql
new file mode 100644
index 00000000..e7630f75
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/services.sql
@@ -0,0 +1,11 @@
+CREATE TABLE services (
+ serviceid int(4) NOT NULL auto_increment,
+ name varchar(128) DEFAULT '' NOT NULL,
+ status int(1) DEFAULT '0' NOT NULL,
+ algorithm int(1) DEFAULT '0' NOT NULL,
+ triggerid int(4),
+ showsla int(1) DEFAULT '0' NOT NULL,
+ goodsla double(5,2) DEFAULT '99.9' NOT NULL,
+ sortorder int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (serviceid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/services_links.sql b/upgrades/dbpatches/1.3/mysql/1.1/services_links.sql
new file mode 100644
index 00000000..eff1625a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/services_links.sql
@@ -0,0 +1,10 @@
+CREATE TABLE services_links (
+ linkid int(4) NOT NULL auto_increment,
+ serviceupid int(4) DEFAULT '0' NOT NULL,
+ servicedownid int(4) DEFAULT '0' NOT NULL,
+ soft int(1) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (linkid),
+-- KEY (serviceupid),
+ KEY (servicedownid),
+ UNIQUE (serviceupid,servicedownid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/sessions b/upgrades/dbpatches/1.3/mysql/1.1/sessions
new file mode 100644
index 00000000..980c53a1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/sessions
@@ -0,0 +1,6 @@
+CREATE TABLE sessions (
+ sessionid varchar(32) NOT NULL DEFAULT '',
+ userid int(4) NOT NULL DEFAULT '0',
+ lastaccess int(4) NOT NULL DEFAULT '0',
+ PRIMARY KEY (sessionid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/sessions.sql b/upgrades/dbpatches/1.3/mysql/1.1/sessions.sql
new file mode 100644
index 00000000..980c53a1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/sessions.sql
@@ -0,0 +1,6 @@
+CREATE TABLE sessions (
+ sessionid varchar(32) NOT NULL DEFAULT '',
+ userid int(4) NOT NULL DEFAULT '0',
+ lastaccess int(4) NOT NULL DEFAULT '0',
+ PRIMARY KEY (sessionid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/sysmaps.sql b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps.sql
new file mode 100644
index 00000000..17f7c258
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps.sql
@@ -0,0 +1,11 @@
+CREATE TABLE sysmaps (
+ sysmapid int(4) NOT NULL auto_increment,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width int(4) DEFAULT '0' NOT NULL,
+ height int(4) DEFAULT '0' NOT NULL,
+ background varchar(64) DEFAULT '' NOT NULL,
+ label_type int(4) DEFAULT '0' NOT NULL,
+ label_location int(1) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (sysmapid),
+ UNIQUE (name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_elements.sql b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_elements.sql
new file mode 100644
index 00000000..fbdda7d3
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_elements.sql
@@ -0,0 +1,14 @@
+CREATE TABLE sysmaps_elements (
+ selementid int(4) NOT NULL auto_increment,
+ sysmapid int(4) DEFAULT '0' NOT NULL,
+ elementid int(4) DEFAULT '0' NOT NULL,
+ elementtype int(4) DEFAULT '0' NOT NULL,
+ icon varchar(32) DEFAULT 'Server' NOT NULL,
+ icon_on varchar(32) DEFAULT 'Server' NOT NULL,
+ label varchar(128) DEFAULT '' NOT NULL,
+ label_location int(1) DEFAULT NULL,
+ x int(4) DEFAULT '0' NOT NULL,
+ y int(4) DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (selementid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_links.sql b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_links.sql
new file mode 100644
index 00000000..df9c1513
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/sysmaps_links.sql
@@ -0,0 +1,13 @@
+CREATE TABLE sysmaps_links (
+ linkid int(4) NOT NULL auto_increment,
+ sysmapid int(4) DEFAULT '0' NOT NULL,
+ selementid1 int(4) DEFAULT '0' NOT NULL,
+ selementid2 int(4) DEFAULT '0' NOT NULL,
+ -- may be NULL
+ triggerid int(4),
+ drawtype_off int(4) DEFAULT '0' NOT NULL,
+ color_off varchar(32) DEFAULT 'Black' NOT NULL,
+ drawtype_on int(4) DEFAULT '0' NOT NULL,
+ color_on varchar(32) DEFAULT 'Red' NOT NULL,
+ PRIMARY KEY (linkid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/trends.sql b/upgrades/dbpatches/1.3/mysql/1.1/trends.sql
new file mode 100644
index 00000000..b235e9a7
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/trends.sql
@@ -0,0 +1,9 @@
+CREATE TABLE trends (
+ itemid int(4) DEFAULT '0' NOT NULL,
+ clock int(4) DEFAULT '0' NOT NULL,
+ num int(2) DEFAULT '0' NOT NULL,
+ value_min double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_avg double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_max double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,clock)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/trigger_depends.sql b/upgrades/dbpatches/1.3/mysql/1.1/trigger_depends.sql
new file mode 100644
index 00000000..9e43590c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/trigger_depends.sql
@@ -0,0 +1,7 @@
+CREATE TABLE trigger_depends (
+ triggerid_down int(4) DEFAULT '0' NOT NULL,
+ triggerid_up int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerid_down, triggerid_up),
+-- KEY (triggerid_down),
+ KEY (triggerid_up)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/triggers.sql b/upgrades/dbpatches/1.3/mysql/1.1/triggers.sql
new file mode 100644
index 00000000..887b4caf
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/triggers.sql
@@ -0,0 +1,17 @@
+CREATE TABLE triggers (
+ triggerid int(4) NOT NULL auto_increment,
+ expression varchar(255) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ status int(4) DEFAULT '0' NOT NULL,
+ value int(4) DEFAULT '0' NOT NULL,
+ priority int(2) DEFAULT '0' NOT NULL,
+ lastchange int(4) DEFAULT '0' NOT NULL,
+ dep_level int(2) DEFAULT '0' NOT NULL,
+ comments blob,
+ error varchar(128) DEFAULT '' NOT NULL,
+ templateid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerid),
+ KEY (status),
+ KEY (value)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/users.sql b/upgrades/dbpatches/1.3/mysql/1.1/users.sql
new file mode 100644
index 00000000..18eb9f21
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/users.sql
@@ -0,0 +1,13 @@
+CREATE TABLE users (
+ userid int(4) NOT NULL auto_increment,
+ alias varchar(100) DEFAULT '' NOT NULL,
+ name varchar(100) DEFAULT '' NOT NULL,
+ surname varchar(100) DEFAULT '' NOT NULL,
+ passwd char(32) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ autologout int(4) DEFAULT '900' NOT NULL,
+ lang varchar(5) DEFAULT 'en_gb' NOT NULL,
+ refresh int(4) DEFAULT '30' NOT NULL,
+ PRIMARY KEY (userid),
+ UNIQUE (alias)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/users_groups.sql b/upgrades/dbpatches/1.3/mysql/1.1/users_groups.sql
new file mode 100644
index 00000000..ebbc8893
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/users_groups.sql
@@ -0,0 +1,5 @@
+CREATE TABLE users_groups (
+ usrgrpid int(4) DEFAULT '0' NOT NULL,
+ userid int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (usrgrpid,userid)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/usrgrp.sql b/upgrades/dbpatches/1.3/mysql/1.1/usrgrp.sql
new file mode 100644
index 00000000..9701b6c9
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/usrgrp.sql
@@ -0,0 +1,6 @@
+CREATE TABLE usrgrp (
+ usrgrpid int(4) NOT NULL auto_increment,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (usrgrpid),
+ UNIQUE (name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.1/valuemaps.sql b/upgrades/dbpatches/1.3/mysql/1.1/valuemaps.sql
new file mode 100644
index 00000000..394f3aa2
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.1/valuemaps.sql
@@ -0,0 +1,6 @@
+CREATE TABLE valuemaps (
+ valuemapid int(4) NOT NULL auto_increment,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (valuemapid),
+ UNIQUE (name)
+) type=InnoDB;
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/acknowledges.sql b/upgrades/dbpatches/1.3/mysql/1.3/acknowledges.sql
new file mode 100644
index 00000000..603c88c5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/acknowledges.sql
@@ -0,0 +1,11 @@
+CREATE TABLE acknowledges (
+ acknowledgeid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ eventid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ message varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (acknowledgeid)
+);
+CREATE INDEX acknowledges_1 on acknowledges (userid);
+CREATE INDEX acknowledges_2 on acknowledges (eventid);
+CREATE INDEX acknowledges_3 on acknowledges (clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/actions.sql b/upgrades/dbpatches/1.3/mysql/1.3/actions.sql
new file mode 100644
index 00000000..ff277579
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/actions.sql
@@ -0,0 +1,14 @@
+CREATE TABLE actions (
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ 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,
+ status integer DEFAULT '0' NOT NULL,
+ scripts blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (actionid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/alerts.sql b/upgrades/dbpatches/1.3/mysql/1.3/alerts.sql
new file mode 100644
index 00000000..0ac338bd
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/alerts.sql
@@ -0,0 +1,25 @@
+CREATE TABLE alerts (
+ alertid bigint unsigned DEFAULT '0' NOT NULL,
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ subject varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
+ 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 (actionid);
+CREATE INDEX alerts_2 on alerts (clock);
+CREATE INDEX alerts_3 on alerts (triggerid);
+CREATE INDEX alerts_4 on alerts (status,retries);
+CREATE INDEX alerts_5 on alerts (mediatypeid);
+CREATE INDEX alerts_6 on alerts (userid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/applications.sql b/upgrades/dbpatches/1.3/mysql/1.3/applications.sql
new file mode 100644
index 00000000..58e95976
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/applications.sql
@@ -0,0 +1,9 @@
+CREATE TABLE applications (
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(255) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (applicationid)
+);
+CREATE INDEX applications_1 on applications (templateid);
+CREATE UNIQUE INDEX applications_2 on applications (hostid,name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/auditlog.sql b/upgrades/dbpatches/1.3/mysql/1.3/auditlog.sql
new file mode 100644
index 00000000..9056b1df
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/auditlog.sql
@@ -0,0 +1,11 @@
+CREATE TABLE auditlog (
+ auditid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ action integer DEFAULT '0' NOT NULL,
+ resourcetype integer DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid)
+);
+CREATE INDEX auditlog_1 on auditlog (userid,clock);
+CREATE INDEX auditlog_2 on auditlog (clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/autoreg.sql b/upgrades/dbpatches/1.3/mysql/1.3/autoreg.sql
new file mode 100644
index 00000000..61bb92f9
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/autoreg.sql
@@ -0,0 +1,7 @@
+CREATE TABLE autoreg (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ priority integer DEFAULT '0' NOT NULL,
+ pattern varchar(255) DEFAULT '' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/conditions.sql b/upgrades/dbpatches/1.3/mysql/1.3/conditions.sql
new file mode 100644
index 00000000..e961111f
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/conditions.sql
@@ -0,0 +1,9 @@
+CREATE TABLE conditions (
+ conditionid bigint unsigned DEFAULT '0' NOT NULL,
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ conditiontype integer DEFAULT '0' NOT NULL,
+ operator integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (conditionid)
+);
+CREATE INDEX conditions_1 on conditions (actionid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/config.sql b/upgrades/dbpatches/1.3/mysql/1.3/config.sql
new file mode 100644
index 00000000..664e57de
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/config.sql
@@ -0,0 +1,8 @@
+CREATE TABLE config (
+ configid bigint unsigned DEFAULT '0' NOT NULL,
+ alert_history integer DEFAULT '0' NOT NULL,
+ event_history integer DEFAULT '0' NOT NULL,
+ refresh_unsupported integer DEFAULT '0' NOT NULL,
+ work_period varchar(100) DEFAULT '1-5,00:00-24:00' NOT NULL,
+ PRIMARY KEY (configid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/events.sql b/upgrades/dbpatches/1.3/mysql/1.3/events.sql
new file mode 100644
index 00000000..597181a4
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/events.sql
@@ -0,0 +1,10 @@
+CREATE TABLE events (
+ eventid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ acknowledged integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (eventid)
+);
+CREATE INDEX events_1 on events (triggerid,clock);
+CREATE INDEX events_2 on events (clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/functions.sql b/upgrades/dbpatches/1.3/mysql/1.3/functions.sql
new file mode 100644
index 00000000..76a48f1d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/functions.sql
@@ -0,0 +1,11 @@
+CREATE TABLE functions (
+ functionid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ lastvalue varchar(255) ,
+ function varchar(12) DEFAULT '' NOT NULL,
+ parameter varchar(255) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (functionid)
+);
+CREATE INDEX functions_1 on functions (triggerid);
+CREATE INDEX functions_2 on functions (itemid,function,parameter);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/graphs.sql b/upgrades/dbpatches/1.3/mysql/1.3/graphs.sql
new file mode 100644
index 00000000..fead04c1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/graphs.sql
@@ -0,0 +1,15 @@
+CREATE TABLE graphs (
+ graphid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width integer DEFAULT '0' NOT NULL,
+ height integer DEFAULT '0' NOT NULL,
+ yaxistype integer DEFAULT '0' NOT NULL,
+ yaxismin double(16,4) DEFAULT '0' NOT NULL,
+ yaxismax double(16,4) DEFAULT '0' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ show_work_period integer DEFAULT '1' NOT NULL,
+ show_triggers integer DEFAULT '1' NOT NULL,
+ graphtype integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (graphid)
+);
+CREATE INDEX graphs_graphs_1 on graphs (name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/graphs_items.sql b/upgrades/dbpatches/1.3/mysql/1.3/graphs_items.sql
new file mode 100644
index 00000000..f4151dde
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/graphs_items.sql
@@ -0,0 +1,13 @@
+CREATE TABLE graphs_items (
+ gitemid bigint unsigned DEFAULT '0' NOT NULL,
+ graphid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ drawtype integer DEFAULT '0' NOT NULL,
+ sortorder integer DEFAULT '0' NOT NULL,
+ color varchar(32) DEFAULT 'Dark Green' NOT NULL,
+ yaxisside integer DEFAULT '1' NOT NULL,
+ calc_fnc integer DEFAULT '2' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ periods_cnt integer DEFAULT '5' NOT NULL,
+ PRIMARY KEY (gitemid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/groups.sql b/upgrades/dbpatches/1.3/mysql/1.3/groups.sql
new file mode 100644
index 00000000..7a971b8d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/groups.sql
@@ -0,0 +1,6 @@
+CREATE TABLE groups (
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (groupid)
+);
+CREATE INDEX groups_1 on groups (name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/help_items.sql b/upgrades/dbpatches/1.3/mysql/1.3/help_items.sql
new file mode 100644
index 00000000..6ff34132
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/help_items.sql
@@ -0,0 +1,6 @@
+CREATE TABLE help_items (
+ itemtype integer DEFAULT '0' NOT NULL,
+ key_ varchar(255) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemtype,key_)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history.sql b/upgrades/dbpatches/1.3/mysql/1.3/history.sql
new file mode 100644
index 00000000..9e89cc6b
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history.sql
@@ -0,0 +1,6 @@
+CREATE TABLE history (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value double(16,4) DEFAULT '0.0000' NOT NULL
+);
+CREATE INDEX history_1 on history (itemid,clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_log.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_log.sql
new file mode 100644
index 00000000..d9cff635
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_log.sql
@@ -0,0 +1,11 @@
+CREATE TABLE history_log (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ timestamp integer DEFAULT '0' NOT NULL,
+ source varchar(64) DEFAULT '' NOT NULL,
+ severity integer DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_log_1 on history_log (itemid,clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_str.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_str.sql
new file mode 100644
index 00000000..4cbb2196
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_str.sql
@@ -0,0 +1,6 @@
+CREATE TABLE history_str (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL
+);
+CREATE INDEX history_str_1 on history_str (itemid,clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_str_sync.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_str_sync.sql
new file mode 100644
index 00000000..a1170393
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_str_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_str_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_str_sync_1 on history_str_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_sync.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_sync.sql
new file mode 100644
index 00000000..9c9feedf
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_sync_1 on history_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_text.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_text.sql
new file mode 100644
index 00000000..18f1642e
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_text.sql
@@ -0,0 +1,8 @@
+CREATE TABLE history_text (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_text_1 on history_text (itemid,clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_uint.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_uint.sql
new file mode 100644
index 00000000..8d8b7d8d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_uint.sql
@@ -0,0 +1,6 @@
+CREATE TABLE history_uint (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value bigint unsigned DEFAULT '0' NOT NULL
+);
+CREATE INDEX history_uint_1 on history_uint (itemid,clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/history_uint_sync.sql b/upgrades/dbpatches/1.3/mysql/1.3/history_uint_sync.sql
new file mode 100644
index 00000000..19f2ef4c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/history_uint_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_uint_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_uint_sync_1 on history_uint_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/hosts.sql b/upgrades/dbpatches/1.3/mysql/1.3/hosts.sql
new file mode 100644
index 00000000..48c108d2
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/hosts.sql
@@ -0,0 +1,15 @@
+CREATE TABLE hosts (
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ host varchar(64) DEFAULT '' NOT NULL,
+ useip integer DEFAULT '1' NOT NULL,
+ ip varchar(15) DEFAULT '127.0.0.1' NOT NULL,
+ port integer DEFAULT '0' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ disable_until integer DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ available integer DEFAULT '0' NOT NULL,
+ errors_from integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostid)
+);
+CREATE INDEX hosts_1 on hosts (host);
+CREATE INDEX hosts_2 on hosts (status);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/hosts_groups.sql b/upgrades/dbpatches/1.3/mysql/1.3/hosts_groups.sql
new file mode 100644
index 00000000..a31410af
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/hosts_groups.sql
@@ -0,0 +1,7 @@
+CREATE TABLE hosts_groups (
+ hostgroupid bigint unsigned DEFAULT '0' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostgroupid)
+);
+CREATE INDEX hosts_groups_groups_1 on hosts_groups (hostid,groupid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/hosts_profiles.sql b/upgrades/dbpatches/1.3/mysql/1.3/hosts_profiles.sql
new file mode 100644
index 00000000..1cb419e5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/hosts_profiles.sql
@@ -0,0 +1,15 @@
+CREATE TABLE hosts_profiles (
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ devicetype varchar(64) DEFAULT '' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ os varchar(64) DEFAULT '' NOT NULL,
+ serialno varchar(64) DEFAULT '' NOT NULL,
+ tag varchar(64) DEFAULT '' NOT NULL,
+ macaddress varchar(64) DEFAULT '' NOT NULL,
+ hardware blob DEFAULT '' NOT NULL,
+ software blob DEFAULT '' NOT NULL,
+ contact blob DEFAULT '' NOT NULL,
+ location blob DEFAULT '' NOT NULL,
+ notes blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (hostid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/hosts_templates.sql b/upgrades/dbpatches/1.3/mysql/1.3/hosts_templates.sql
new file mode 100644
index 00000000..93872a12
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/hosts_templates.sql
@@ -0,0 +1,7 @@
+CREATE TABLE hosts_templates (
+ hosttemplateid bigint unsigned DEFAULT '0' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hosttemplateid)
+);
+CREATE UNIQUE INDEX hosts_templates_1 on hosts_templates (hostid,templateid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/housekeeper.sql b/upgrades/dbpatches/1.3/mysql/1.3/housekeeper.sql
new file mode 100644
index 00000000..a00ab476
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/housekeeper.sql
@@ -0,0 +1,7 @@
+CREATE TABLE housekeeper (
+ housekeeperid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ field varchar(64) DEFAULT '' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (housekeeperid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/httpstep.sql b/upgrades/dbpatches/1.3/mysql/1.3/httpstep.sql
new file mode 100644
index 00000000..958c0211
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/httpstep.sql
@@ -0,0 +1,12 @@
+CREATE TABLE httpstep (
+ httpstepid bigint unsigned DEFAULT '0' NOT NULL,
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ no integer DEFAULT '0' NOT NULL,
+ url varchar(128) DEFAULT '' NOT NULL,
+ timeout integer DEFAULT '30' NOT NULL,
+ posts blob DEFAULT '' NOT NULL,
+ required varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (httpstepid)
+);
+CREATE INDEX httpstep_httpstep_1 on httpstep (httptestid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/httpstepitem.sql b/upgrades/dbpatches/1.3/mysql/1.3/httpstepitem.sql
new file mode 100644
index 00000000..3a0fa50d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/httpstepitem.sql
@@ -0,0 +1,8 @@
+CREATE TABLE httpstepitem (
+ httpstepitemid bigint unsigned DEFAULT '0' NOT NULL,
+ httpstepid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httpstepitemid)
+);
+CREATE UNIQUE INDEX httpstepitem_httpstepitem_1 on httpstepitem (httpstepid,itemid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/httptest.sql b/upgrades/dbpatches/1.3/mysql/1.3/httptest.sql
new file mode 100644
index 00000000..4197f377
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/httptest.sql
@@ -0,0 +1,17 @@
+CREATE TABLE httptest (
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ lastcheck integer DEFAULT '0' NOT NULL,
+ nextcheck integer DEFAULT '0' NOT NULL,
+ curstate integer DEFAULT '0' NOT NULL,
+ curstep integer DEFAULT '0' NOT NULL,
+ lastfailedstep bigint unsigned DEFAULT '0' NOT NULL,
+ delay integer DEFAULT '60' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ macros blob DEFAULT '' NOT NULL,
+ agent varchar(255) DEFAULT '' NOT NULL,
+ time double(16,4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httptestid)
+);
+CREATE INDEX httptest_httptest_1 on httptest (httptestid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/httptestitem.sql b/upgrades/dbpatches/1.3/mysql/1.3/httptestitem.sql
new file mode 100644
index 00000000..a8fa36d9
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/httptestitem.sql
@@ -0,0 +1,8 @@
+CREATE TABLE httptestitem (
+ httptestitemid bigint unsigned DEFAULT '0' NOT NULL,
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httptestitemid)
+);
+CREATE UNIQUE INDEX httptestitem_httptestitem_1 on httptestitem (httptestid,itemid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/images.sql b/upgrades/dbpatches/1.3/mysql/1.3/images.sql
new file mode 100644
index 00000000..2b7b7024
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/images.sql
@@ -0,0 +1,8 @@
+CREATE TABLE images (
+ imageid bigint unsigned DEFAULT '0' NOT NULL,
+ imagetype integer DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '0' NOT NULL,
+ image longblob DEFAULT '' NOT NULL,
+ PRIMARY KEY (imageid)
+);
+CREATE INDEX images_1 on images (imagetype,name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/items.sql b/upgrades/dbpatches/1.3/mysql/1.3/items.sql
new file mode 100644
index 00000000..a898583d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/items.sql
@@ -0,0 +1,39 @@
+CREATE TABLE items (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ snmp_community varchar(64) DEFAULT '' NOT NULL,
+ snmp_oid varchar(255) DEFAULT '' NOT NULL,
+ snmp_port integer DEFAULT '161' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ key_ varchar(255) DEFAULT '' NOT NULL,
+ delay integer DEFAULT '0' NOT NULL,
+ history integer DEFAULT '90' NOT NULL,
+ trends integer DEFAULT '365' NOT NULL,
+ nextcheck integer DEFAULT '0' NOT NULL,
+ lastvalue varchar(255) NULL,
+ lastclock integer NULL,
+ prevvalue varchar(255) NULL,
+ status integer DEFAULT '0' NOT NULL,
+ value_type integer DEFAULT '0' NOT NULL,
+ trapper_hosts varchar(255) DEFAULT '' NOT NULL,
+ units varchar(10) DEFAULT '' NOT NULL,
+ multiplier integer DEFAULT '0' NOT NULL,
+ delta integer DEFAULT '0' NOT NULL,
+ prevorgvalue varchar(255) NULL,
+ snmpv3_securityname varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_securitylevel integer DEFAULT '0' NOT NULL,
+ snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL,
+ formula varchar(255) DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ lastlogsize integer DEFAULT '0' NOT NULL,
+ logtimefmt varchar(64) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ delay_flex varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemid)
+);
+CREATE UNIQUE INDEX items_1 on items (hostid,key_);
+CREATE INDEX items_2 on items (nextcheck);
+CREATE INDEX items_3 on items (status);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/items_applications.sql b/upgrades/dbpatches/1.3/mysql/1.3/items_applications.sql
new file mode 100644
index 00000000..a57fc150
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/items_applications.sql
@@ -0,0 +1,7 @@
+CREATE TABLE items_applications (
+ itemappid bigint unsigned DEFAULT '0' NOT NULL,
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (itemappid)
+);
+CREATE INDEX items_applications_1 on items_applications (applicationid,itemid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/mappings.sql b/upgrades/dbpatches/1.3/mysql/1.3/mappings.sql
new file mode 100644
index 00000000..216b7192
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/mappings.sql
@@ -0,0 +1,8 @@
+CREATE TABLE mappings (
+ mappingid bigint unsigned DEFAULT '0' NOT NULL,
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ value varchar(64) DEFAULT '' NOT NULL,
+ newvalue varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mappingid)
+);
+CREATE INDEX mappings_1 on mappings (valuemapid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/media.sql b/upgrades/dbpatches/1.3/mysql/1.3/media.sql
new file mode 100644
index 00000000..1211847c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/media.sql
@@ -0,0 +1,12 @@
+CREATE TABLE media (
+ mediaid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ active integer DEFAULT '0' NOT NULL,
+ severity integer DEFAULT '63' NOT NULL,
+ period varchar(100) DEFAULT '1-7,00:00-23:59' NOT NULL,
+ PRIMARY KEY (mediaid)
+);
+CREATE INDEX media_1 on media (userid);
+CREATE INDEX media_2 on media (mediatypeid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/media_type.sql b/upgrades/dbpatches/1.3/mysql/1.3/media_type.sql
new file mode 100644
index 00000000..7db92f49
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/media_type.sql
@@ -0,0 +1,11 @@
+CREATE TABLE media_type (
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ description varchar(100) DEFAULT '' NOT NULL,
+ smtp_server varchar(255) DEFAULT '' NOT NULL,
+ smtp_helo varchar(255) DEFAULT '' NOT NULL,
+ smtp_email varchar(255) DEFAULT '' NOT NULL,
+ exec_path varchar(255) DEFAULT '' NOT NULL,
+ gsm_modem varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mediatypeid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/node_cksum.sql b/upgrades/dbpatches/1.3/mysql/1.3/node_cksum.sql
new file mode 100644
index 00000000..cd675a76
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/node_cksum.sql
@@ -0,0 +1,11 @@
+CREATE TABLE node_cksum (
+ cksumid bigint unsigned DEFAULT '0' NOT NULL,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ fieldname varchar(64) DEFAULT '' NOT NULL,
+ recordid bigint unsigned DEFAULT '0' NOT NULL,
+ cksumtype integer DEFAULT '0' NOT NULL,
+ cksum char(32) DEFAULT '' NOT NULL,
+ PRIMARY KEY (cksumid)
+);
+CREATE INDEX node_cksum_cksum_1 on node_cksum (nodeid,tablename,fieldname,recordid,cksumtype);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/node_configlog.sql b/upgrades/dbpatches/1.3/mysql/1.3/node_configlog.sql
new file mode 100644
index 00000000..f80f9b25
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/node_configlog.sql
@@ -0,0 +1,12 @@
+CREATE TABLE node_configlog (
+ conflogid bigint unsigned DEFAULT '0' NOT NULL,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ recordid bigint unsigned DEFAULT '0' NOT NULL,
+ operation integer DEFAULT '0' NOT NULL,
+ sync_master integer DEFAULT '0' NOT NULL,
+ sync_slave integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (nodeid,conflogid)
+);
+CREATE INDEX node_configlog_configlog_1 on node_configlog (conflogid);
+CREATE INDEX node_configlog_configlog_2 on node_configlog (nodeid,tablename);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/nodes.sql b/upgrades/dbpatches/1.3/mysql/1.3/nodes.sql
new file mode 100644
index 00000000..88acf5ed
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/nodes.sql
@@ -0,0 +1,18 @@
+CREATE TABLE nodes (
+ nodeid integer DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '0' NOT NULL,
+ timezone integer DEFAULT '0' NOT NULL,
+ ip varchar(15) DEFAULT '' NOT NULL,
+ port integer DEFAULT '10051' NOT NULL,
+ slave_history integer DEFAULT '30' NOT NULL,
+ slave_trends integer DEFAULT '365' NOT NULL,
+ event_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ events_eventid bigint unsigned DEFAULT '0' NOT NULL,
+ alerts_alertid bigint unsigned DEFAULT '0' NOT NULL,
+ history_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ history_str_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ history_uint_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ nodetype integer DEFAULT '0' NOT NULL,
+ masterid integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (nodeid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/profiles.sql b/upgrades/dbpatches/1.3/mysql/1.3/profiles.sql
new file mode 100644
index 00000000..e01b892a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/profiles.sql
@@ -0,0 +1,9 @@
+CREATE TABLE profiles (
+ profileid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ idx varchar(64) DEFAULT '' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ valuetype integer DEFAULT 0 NOT NULL,
+ PRIMARY KEY (profileid)
+);
+CREATE UNIQUE INDEX profiles_1 on profiles (userid,idx);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/rights.sql b/upgrades/dbpatches/1.3/mysql/1.3/rights.sql
new file mode 100644
index 00000000..9a1fdc23
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/rights.sql
@@ -0,0 +1,9 @@
+CREATE TABLE rights (
+ rightid bigint unsigned DEFAULT '0' NOT NULL,
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ permission integer DEFAULT '0' NOT NULL,
+ id bigint unsigned ,
+ PRIMARY KEY (rightid)
+);
+CREATE INDEX rights_1 on rights (groupid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/screens.sql b/upgrades/dbpatches/1.3/mysql/1.3/screens.sql
new file mode 100644
index 00000000..982aec52
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/screens.sql
@@ -0,0 +1,7 @@
+CREATE TABLE screens (
+ screenid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(255) DEFAULT 'Screen' NOT NULL,
+ hsize integer DEFAULT '1' NOT NULL,
+ vsize integer DEFAULT '1' NOT NULL,
+ PRIMARY KEY (screenid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/screens_items.sql b/upgrades/dbpatches/1.3/mysql/1.3/screens_items.sql
new file mode 100644
index 00000000..458e212f
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/screens_items.sql
@@ -0,0 +1,18 @@
+CREATE TABLE screens_items (
+ screenitemid bigint unsigned DEFAULT '0' NOT NULL,
+ screenid bigint unsigned DEFAULT '0' NOT NULL,
+ resourcetype integer DEFAULT '0' NOT NULL,
+ resourceid bigint unsigned DEFAULT '0' NOT NULL,
+ width integer DEFAULT '320' NOT NULL,
+ height integer DEFAULT '200' NOT NULL,
+ x integer DEFAULT '0' NOT NULL,
+ y integer DEFAULT '0' NOT NULL,
+ colspan integer DEFAULT '0' NOT NULL,
+ rowspan integer DEFAULT '0' NOT NULL,
+ elements integer DEFAULT '25' NOT NULL,
+ valign integer DEFAULT '0' NOT NULL,
+ halign integer DEFAULT '0' NOT NULL,
+ style integer DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (screenitemid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/service_alarms.sql b/upgrades/dbpatches/1.3/mysql/1.3/service_alarms.sql
new file mode 100644
index 00000000..6d01e21d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/service_alarms.sql
@@ -0,0 +1,9 @@
+CREATE TABLE service_alarms (
+ servicealarmid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (servicealarmid)
+);
+CREATE INDEX service_alarms_1 on service_alarms (serviceid,clock);
+CREATE INDEX service_alarms_2 on service_alarms (clock);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/services.sql b/upgrades/dbpatches/1.3/mysql/1.3/services.sql
new file mode 100644
index 00000000..c431febc
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/services.sql
@@ -0,0 +1,11 @@
+CREATE TABLE services (
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ algorithm integer DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned ,
+ showsla integer DEFAULT '0' NOT NULL,
+ goodsla double(5,2) DEFAULT '99.9' NOT NULL,
+ sortorder integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (serviceid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/services_links.sql b/upgrades/dbpatches/1.3/mysql/1.3/services_links.sql
new file mode 100644
index 00000000..3dea6f85
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/services_links.sql
@@ -0,0 +1,9 @@
+CREATE TABLE services_links (
+ linkid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceupid bigint unsigned DEFAULT '0' NOT NULL,
+ servicedownid bigint unsigned DEFAULT '0' NOT NULL,
+ soft integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (linkid)
+);
+CREATE INDEX services_links_links_1 on services_links (servicedownid);
+CREATE UNIQUE INDEX services_links_links_2 on services_links (serviceupid,servicedownid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/services_times.sql b/upgrades/dbpatches/1.3/mysql/1.3/services_times.sql
new file mode 100644
index 00000000..444a26d1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/services_times.sql
@@ -0,0 +1,10 @@
+CREATE TABLE services_times (
+ timeid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ ts_from integer DEFAULT '0' NOT NULL,
+ ts_to integer DEFAULT '0' NOT NULL,
+ note varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (timeid)
+);
+CREATE INDEX services_times_times_1 on services_times (serviceid,type,ts_from,ts_to);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/sessions.sql b/upgrades/dbpatches/1.3/mysql/1.3/sessions.sql
new file mode 100644
index 00000000..b56c38c6
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/sessions.sql
@@ -0,0 +1,6 @@
+CREATE TABLE sessions (
+ sessionid varchar(32) DEFAULT '' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ lastaccess integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (sessionid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/sysmaps.sql b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps.sql
new file mode 100644
index 00000000..e6fecb34
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps.sql
@@ -0,0 +1,11 @@
+CREATE TABLE sysmaps (
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width integer DEFAULT '0' NOT NULL,
+ height integer DEFAULT '0' NOT NULL,
+ backgroundid bigint unsigned DEFAULT '0' NOT NULL,
+ label_type integer DEFAULT '0' NOT NULL,
+ label_location integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (sysmapid)
+);
+CREATE INDEX sysmaps_1 on sysmaps (name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_elements.sql b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_elements.sql
new file mode 100644
index 00000000..4d751633
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_elements.sql
@@ -0,0 +1,14 @@
+CREATE TABLE sysmaps_elements (
+ selementid bigint unsigned DEFAULT '0' NOT NULL,
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ elementid bigint unsigned DEFAULT '0' NOT NULL,
+ elementtype integer DEFAULT '0' NOT NULL,
+ iconid_off bigint unsigned DEFAULT '0' NOT NULL,
+ iconid_on bigint unsigned DEFAULT '0' NOT NULL,
+ label varchar(128) DEFAULT '' NOT NULL,
+ label_location integer NULL,
+ x integer DEFAULT '0' NOT NULL,
+ y integer DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (selementid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_links.sql b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_links.sql
new file mode 100644
index 00000000..c088eb2c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/sysmaps_links.sql
@@ -0,0 +1,12 @@
+CREATE TABLE sysmaps_links (
+ linkid bigint unsigned DEFAULT '0' NOT NULL,
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ selementid1 bigint unsigned DEFAULT '0' NOT NULL,
+ selementid2 bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned ,
+ drawtype_off integer DEFAULT '0' NOT NULL,
+ color_off varchar(32) DEFAULT 'Black' NOT NULL,
+ drawtype_on integer DEFAULT '0' NOT NULL,
+ color_on varchar(32) DEFAULT 'Red' NOT NULL,
+ PRIMARY KEY (linkid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/trends.sql b/upgrades/dbpatches/1.3/mysql/1.3/trends.sql
new file mode 100644
index 00000000..03488daf
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/trends.sql
@@ -0,0 +1,9 @@
+CREATE TABLE trends (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ num integer DEFAULT '0' NOT NULL,
+ value_min double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_avg double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_max double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,clock)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/trigger_depends.sql b/upgrades/dbpatches/1.3/mysql/1.3/trigger_depends.sql
new file mode 100644
index 00000000..07bfd694
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/trigger_depends.sql
@@ -0,0 +1,8 @@
+CREATE TABLE trigger_depends (
+ triggerdepid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid_down bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid_up bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerdepid)
+);
+CREATE INDEX trigger_depends_1 on trigger_depends (triggerid_down,triggerid_up);
+CREATE INDEX trigger_depends_2 on trigger_depends (triggerid_up);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/triggers.sql b/upgrades/dbpatches/1.3/mysql/1.3/triggers.sql
new file mode 100644
index 00000000..b25254f5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/triggers.sql
@@ -0,0 +1,17 @@
+CREATE TABLE triggers (
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ expression varchar(255) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ priority integer DEFAULT '0' NOT NULL,
+ lastchange integer DEFAULT '0' NOT NULL,
+ dep_level integer DEFAULT '0' NOT NULL,
+ comments blob ,
+ error varchar(128) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerid)
+);
+CREATE INDEX triggers_1 on triggers (status);
+CREATE INDEX triggers_2 on triggers (value);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/users.sql b/upgrades/dbpatches/1.3/mysql/1.3/users.sql
new file mode 100644
index 00000000..d695ab26
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/users.sql
@@ -0,0 +1,14 @@
+CREATE TABLE users (
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ alias varchar(100) DEFAULT '' NOT NULL,
+ name varchar(100) DEFAULT '' NOT NULL,
+ surname varchar(100) DEFAULT '' NOT NULL,
+ passwd char(32) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ autologout integer DEFAULT '900' NOT NULL,
+ lang varchar(5) DEFAULT 'en_gb' NOT NULL,
+ refresh integer DEFAULT '30' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (userid)
+);
+CREATE INDEX users_1 on users (alias);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/users_groups.sql b/upgrades/dbpatches/1.3/mysql/1.3/users_groups.sql
new file mode 100644
index 00000000..26cedcd5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/users_groups.sql
@@ -0,0 +1,7 @@
+CREATE TABLE users_groups (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ usrgrpid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX users_groups_1 on users_groups (usrgrpid,userid);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/usrgrp.sql b/upgrades/dbpatches/1.3/mysql/1.3/usrgrp.sql
new file mode 100644
index 00000000..b811fc98
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/usrgrp.sql
@@ -0,0 +1,6 @@
+CREATE TABLE usrgrp (
+ usrgrpid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (usrgrpid)
+);
+CREATE INDEX usrgrp_1 on usrgrp (name);
diff --git a/upgrades/dbpatches/1.3/mysql/1.3/valuemaps.sql b/upgrades/dbpatches/1.3/mysql/1.3/valuemaps.sql
new file mode 100644
index 00000000..5eaa6983
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/1.3/valuemaps.sql
@@ -0,0 +1,6 @@
+CREATE TABLE valuemaps (
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (valuemapid)
+);
+CREATE INDEX valuemaps_1 on valuemaps (name);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/acknowledges.sql b/upgrades/dbpatches/1.3/mysql/patch/acknowledges.sql
new file mode 100644
index 00000000..ad291442
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/acknowledges.sql
@@ -0,0 +1,15 @@
+CREATE TABLE acknowledges_tmp (
+ acknowledgeid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ eventid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ message varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (acknowledgeid)
+);
+CREATE INDEX acknowledges_1 on acknowledges_tmp (userid);
+CREATE INDEX acknowledges_2 on acknowledges_tmp (eventid);
+CREATE INDEX acknowledges_3 on acknowledges_tmp (clock);
+
+insert into acknowledges_tmp select * from acknowledges;
+drop table acknowledges;
+alter table acknowledges_tmp rename acknowledges;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/actions.sql b/upgrades/dbpatches/1.3/mysql/patch/actions.sql
new file mode 100644
index 00000000..056686ae
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/actions.sql
@@ -0,0 +1,18 @@
+CREATE TABLE actions_tmp (
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ 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,
+ status integer DEFAULT '0' NOT NULL,
+ scripts blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (actionid)
+);
+
+insert into actions_tmp select * 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
new file mode 100644
index 00000000..4dfbdc98
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/alerts.sql
@@ -0,0 +1,29 @@
+CREATE TABLE alerts_tmp (
+ alertid bigint unsigned DEFAULT '0' NOT NULL,
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ subject varchar(255) DEFAULT '' NOT NULL,
+ message blob DEFAULT '' NOT NULL,
+ 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);
+CREATE INDEX alerts_2 on alerts_tmp (clock);
+CREATE INDEX alerts_3 on alerts_tmp (triggerid);
+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;
+drop table alerts;
+alter table alerts_tmp rename alerts;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/applications.sql b/upgrades/dbpatches/1.3/mysql/patch/applications.sql
new file mode 100644
index 00000000..fd2b07f6
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/applications.sql
@@ -0,0 +1,13 @@
+CREATE TABLE applications_tmp (
+ applicationid bigint unsigned NOT NULL auto_increment,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(255) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (applicationid)
+);
+CREATE INDEX applications_1 on applications_tmp (templateid);
+CREATE UNIQUE INDEX applications_2 on applications_tmp (hostid,name);
+
+insert into applications_tmp select * from applications;
+drop table applications;
+alter table applications_tmp rename applications;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/auditlog.sql b/upgrades/dbpatches/1.3/mysql/patch/auditlog.sql
new file mode 100644
index 00000000..e34d96f8
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/auditlog.sql
@@ -0,0 +1,15 @@
+CREATE TABLE auditlog_tmp (
+ auditid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ action integer DEFAULT '0' NOT NULL,
+ resourcetype integer DEFAULT '0' NOT NULL,
+ details varchar(128) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (auditid)
+);
+CREATE INDEX auditlog_1 on auditlog_tmp (userid,clock);
+CREATE INDEX auditlog_2 on auditlog_tmp (clock);
+
+insert into auditlog_tmp select * from auditlog;
+drop table auditlog;
+alter table auditlog_tmp rename auditlog;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/autoreg.sql b/upgrades/dbpatches/1.3/mysql/patch/autoreg.sql
new file mode 100644
index 00000000..8914f770
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/autoreg.sql
@@ -0,0 +1,11 @@
+CREATE TABLE autoreg_tmp (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ priority integer DEFAULT '0' NOT NULL,
+ pattern varchar(255) DEFAULT '' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+
+insert into autoreg_tmp select * from autoreg;
+drop table autoreg;
+alter table autoreg_tmp rename autoreg;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/conditions.sql b/upgrades/dbpatches/1.3/mysql/patch/conditions.sql
new file mode 100644
index 00000000..1c328990
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/conditions.sql
@@ -0,0 +1,13 @@
+CREATE TABLE conditions_tmp (
+ conditionid bigint unsigned DEFAULT '0' NOT NULL,
+ actionid bigint unsigned DEFAULT '0' NOT NULL,
+ conditiontype integer DEFAULT '0' NOT NULL,
+ operator integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (conditionid)
+);
+CREATE INDEX conditions_1 on conditions_tmp (actionid);
+
+insert into conditions_tmp select * from conditions;
+drop table conditions;
+alter table conditions_tmp rename conditions;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/config.sql b/upgrades/dbpatches/1.3/mysql/patch/config.sql
new file mode 100644
index 00000000..062f9eb2
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/config.sql
@@ -0,0 +1,12 @@
+CREATE TABLE config_tmp (
+ configid bigint unsigned DEFAULT '0' NOT NULL,
+ alert_history integer DEFAULT '0' NOT NULL,
+ event_history integer DEFAULT '0' NOT NULL,
+ refresh_unsupported integer DEFAULT '0' NOT NULL,
+ work_period varchar(100) DEFAULT '1-5,00:00-24:00' NOT NULL,
+ PRIMARY KEY (configid)
+);
+
+insert into config_tmp select 1,alert_history,alarm_history,refresh_unsupported,work_period from config;
+drop table config;
+alter table config_tmp rename config;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/events.sql b/upgrades/dbpatches/1.3/mysql/patch/events.sql
new file mode 100644
index 00000000..e4a43f5b
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/events.sql
@@ -0,0 +1,13 @@
+CREATE TABLE events (
+ eventid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ acknowledged integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (eventid)
+);
+CREATE INDEX events_1 on events (triggerid,clock);
+CREATE INDEX events_2 on events (clock);
+
+insert into events select * from alarms;
+drop table alarms;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/functions.sql b/upgrades/dbpatches/1.3/mysql/patch/functions.sql
new file mode 100644
index 00000000..0817aec5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/functions.sql
@@ -0,0 +1,15 @@
+CREATE TABLE functions_tmp (
+ functionid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ lastvalue varchar(255) ,
+ function varchar(12) DEFAULT '' NOT NULL,
+ parameter varchar(255) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (functionid)
+);
+CREATE INDEX functions_1 on functions_tmp (triggerid);
+CREATE INDEX functions_2 on functions_tmp (itemid,function,parameter);
+
+insert into functions_tmp select * from functions;
+drop table functions;
+alter table functions_tmp rename functions;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/graphs.sql b/upgrades/dbpatches/1.3/mysql/patch/graphs.sql
new file mode 100644
index 00000000..66a2b113
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/graphs.sql
@@ -0,0 +1,19 @@
+CREATE TABLE graphs_tmp (
+ graphid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width integer DEFAULT '0' NOT NULL,
+ height integer DEFAULT '0' NOT NULL,
+ yaxistype integer DEFAULT '0' NOT NULL,
+ yaxismin double(16,4) DEFAULT '0' NOT NULL,
+ yaxismax double(16,4) DEFAULT '0' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ show_work_period integer DEFAULT '1' NOT NULL,
+ show_triggers integer DEFAULT '1' NOT NULL,
+ graphtype integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (graphid)
+);
+CREATE INDEX graphs_graphs_1 on graphs_tmp (name);
+
+insert into graphs_tmp select *,0 from graphs;
+drop table graphs;
+alter table graphs_tmp rename graphs;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/graphs_items.sql b/upgrades/dbpatches/1.3/mysql/patch/graphs_items.sql
new file mode 100644
index 00000000..2145623d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/graphs_items.sql
@@ -0,0 +1,17 @@
+CREATE TABLE graphs_items_tmp (
+ gitemid bigint unsigned DEFAULT '0' NOT NULL,
+ graphid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ drawtype integer DEFAULT '0' NOT NULL,
+ sortorder integer DEFAULT '0' NOT NULL,
+ color varchar(32) DEFAULT 'Dark Green' NOT NULL,
+ yaxisside integer DEFAULT '1' NOT NULL,
+ calc_fnc integer DEFAULT '2' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ periods_cnt integer DEFAULT '5' NOT NULL,
+ PRIMARY KEY (gitemid)
+);
+
+insert into graphs_items_tmp select * from graphs_items;
+drop table graphs_items;
+alter table graphs_items_tmp rename graphs_items;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/groups.sql b/upgrades/dbpatches/1.3/mysql/patch/groups.sql
new file mode 100644
index 00000000..50d34437
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/groups.sql
@@ -0,0 +1,10 @@
+CREATE TABLE groups_tmp (
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (groupid)
+);
+CREATE INDEX groups_1 on groups_tmp (name);
+
+insert into groups_tmp select * from groups;
+drop table groups;
+alter table groups_tmp rename groups;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/help_items.sql b/upgrades/dbpatches/1.3/mysql/patch/help_items.sql
new file mode 100644
index 00000000..718279c5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/help_items.sql
@@ -0,0 +1,10 @@
+CREATE TABLE help_items_tmp (
+ itemtype integer DEFAULT '0' NOT NULL,
+ key_ varchar(255) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemtype,key_)
+);
+
+insert into help_items_tmp select * from help_items;
+drop table help_items;
+alter table help_items_tmp rename help_items;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history.sql b/upgrades/dbpatches/1.3/mysql/patch/history.sql
new file mode 100644
index 00000000..ad7763ab
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history.sql
@@ -0,0 +1,10 @@
+CREATE TABLE history_tmp (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value double(16,4) DEFAULT '0.0000' NOT NULL
+);
+CREATE INDEX history_1 on history_tmp (itemid,clock);
+
+insert into history_tmp select * from history;
+drop table history;
+alter table history_tmp rename history;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_log.sql b/upgrades/dbpatches/1.3/mysql/patch/history_log.sql
new file mode 100644
index 00000000..cd2e2889
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_log.sql
@@ -0,0 +1,15 @@
+CREATE TABLE history_log_tmp (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ timestamp integer DEFAULT '0' NOT NULL,
+ source varchar(64) DEFAULT '' NOT NULL,
+ severity integer DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_log_1 on history_log_tmp (itemid,clock);
+
+insert into history_log_tmp select * from history_log;
+drop table history_log;
+alter table history_log_tmp rename history_log;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_str.sql b/upgrades/dbpatches/1.3/mysql/patch/history_str.sql
new file mode 100644
index 00000000..9a3732be
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_str.sql
@@ -0,0 +1,10 @@
+CREATE TABLE history_str_tmp (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL
+);
+CREATE INDEX history_str_1 on history_str_tmp (itemid,clock);
+
+insert into history_str_tmp select * from history_str;
+drop table history_str;
+alter table history_str_tmp rename history_str;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_str_sync.sql b/upgrades/dbpatches/1.3/mysql/patch/history_str_sync.sql
new file mode 100644
index 00000000..a1170393
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_str_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_str_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_str_sync_1 on history_str_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_sync.sql b/upgrades/dbpatches/1.3/mysql/patch/history_sync.sql
new file mode 100644
index 00000000..9c9feedf
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_sync_1 on history_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_text.sql b/upgrades/dbpatches/1.3/mysql/patch/history_text.sql
new file mode 100644
index 00000000..68fa4dd3
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_text.sql
@@ -0,0 +1,12 @@
+CREATE TABLE history_text_tmp (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value text DEFAULT '' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_text_1 on history_text_tmp (itemid,clock);
+
+insert into history_text_tmp select * from history_text;
+drop table history_text;
+alter table history_text_tmp rename history_text;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_uint.sql b/upgrades/dbpatches/1.3/mysql/patch/history_uint.sql
new file mode 100644
index 00000000..aa65ae28
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_uint.sql
@@ -0,0 +1,10 @@
+CREATE TABLE history_uint_tmp (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value bigint unsigned DEFAULT '0' NOT NULL
+);
+CREATE INDEX history_uint_1 on history_uint_tmp (itemid,clock);
+
+insert into history_uint_tmp select * from history_uint;
+drop table history_uint;
+alter table history_uint_tmp rename history_uint;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/history_uint_sync.sql b/upgrades/dbpatches/1.3/mysql/patch/history_uint_sync.sql
new file mode 100644
index 00000000..19f2ef4c
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/history_uint_sync.sql
@@ -0,0 +1,9 @@
+CREATE TABLE history_uint_sync (
+ id serial ,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX history_uint_sync_1 on history_uint_sync (nodeid,id);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/hosts.sql b/upgrades/dbpatches/1.3/mysql/patch/hosts.sql
new file mode 100644
index 00000000..9aa28279
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/hosts.sql
@@ -0,0 +1,19 @@
+CREATE TABLE hosts_tmp (
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ host varchar(64) DEFAULT '' NOT NULL,
+ useip integer DEFAULT '1' NOT NULL,
+ ip varchar(15) DEFAULT '127.0.0.1' NOT NULL,
+ port integer DEFAULT '0' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ disable_until integer DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ available integer DEFAULT '0' NOT NULL,
+ errors_from integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostid)
+);
+CREATE INDEX hosts_1 on hosts_tmp (host);
+CREATE INDEX hosts_2 on hosts_tmp (status);
+
+insert into hosts_tmp select hostid,host,useip,ip,port,status,disable_until,error,available,errors_from from hosts;
+drop table hosts;
+alter table hosts_tmp rename hosts;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/hosts_groups.sql b/upgrades/dbpatches/1.3/mysql/patch/hosts_groups.sql
new file mode 100644
index 00000000..05b179d1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/hosts_groups.sql
@@ -0,0 +1,24 @@
+CREATE TABLE hosts_groups_tmp (
+ hostgroupid bigint unsigned NOT NULL auto_increment,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostgroupid)
+);
+CREATE INDEX hosts_groups_groups_1 on hosts_groups_tmp (hostid,groupid);
+
+insert into hosts_groups_tmp select NULL,hostid,groupid from hosts_groups;
+drop table hosts_groups;
+alter table hosts_groups_tmp rename hosts_groups;
+
+
+CREATE TABLE hosts_groups_tmp (
+ hostgroupid bigint unsigned DEFAULT '0' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hostgroupid)
+);
+CREATE INDEX hosts_groups_groups_1 on hosts_groups_tmp (hostid,groupid);
+
+insert into hosts_groups_tmp select * from hosts_groups;
+drop table hosts_groups;
+alter table hosts_groups_tmp rename hosts_groups;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/hosts_profiles.sql b/upgrades/dbpatches/1.3/mysql/patch/hosts_profiles.sql
new file mode 100644
index 00000000..379cdfd2
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/hosts_profiles.sql
@@ -0,0 +1,19 @@
+CREATE TABLE hosts_profiles_tmp (
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ devicetype varchar(64) DEFAULT '' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ os varchar(64) DEFAULT '' NOT NULL,
+ serialno varchar(64) DEFAULT '' NOT NULL,
+ tag varchar(64) DEFAULT '' NOT NULL,
+ macaddress varchar(64) DEFAULT '' NOT NULL,
+ hardware blob DEFAULT '' NOT NULL,
+ software blob DEFAULT '' NOT NULL,
+ contact blob DEFAULT '' NOT NULL,
+ location blob DEFAULT '' NOT NULL,
+ notes blob DEFAULT '' NOT NULL,
+ PRIMARY KEY (hostid)
+);
+
+insert into hosts_profiles_tmp select * from hosts_profiles;
+drop table hosts_profiles;
+alter table hosts_profiles_tmp rename hosts_profiles;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/hosts_templates.sql b/upgrades/dbpatches/1.3/mysql/patch/hosts_templates.sql
new file mode 100644
index 00000000..7c40627f
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/hosts_templates.sql
@@ -0,0 +1,23 @@
+CREATE TABLE hosts_templates_tmp (
+ hosttemplateid bigint unsigned NOT NULL auto_increment,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hosttemplateid)
+);
+CREATE UNIQUE INDEX hosts_templates_1 on hosts_templates_tmp (hostid,templateid);
+
+insert into hosts_templates_tmp select NULL,hostid,templateid from hosts_templates;
+drop table hosts_templates;
+alter table hosts_templates_tmp rename hosts_templates;
+
+CREATE TABLE hosts_templates_tmp (
+ hosttemplateid bigint unsigned DEFAULT '0' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (hosttemplateid)
+);
+CREATE UNIQUE INDEX hosts_templates_1 on hosts_templates_tmp (hostid,templateid);
+
+insert into hosts_templates_tmp select * from hosts_templates;
+drop table hosts_templates;
+alter table hosts_templates_tmp rename hosts_templates;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/housekeeper.sql b/upgrades/dbpatches/1.3/mysql/patch/housekeeper.sql
new file mode 100644
index 00000000..c67f0b73
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/housekeeper.sql
@@ -0,0 +1,11 @@
+CREATE TABLE housekeeper_tmp (
+ housekeeperid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ field varchar(64) DEFAULT '' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (housekeeperid)
+);
+
+insert into housekeeper_tmp select * from housekeeper;
+drop table housekeeper;
+alter table housekeeper_tmp rename housekeeper;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/httpstep.sql b/upgrades/dbpatches/1.3/mysql/patch/httpstep.sql
new file mode 100644
index 00000000..958c0211
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/httpstep.sql
@@ -0,0 +1,12 @@
+CREATE TABLE httpstep (
+ httpstepid bigint unsigned DEFAULT '0' NOT NULL,
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ no integer DEFAULT '0' NOT NULL,
+ url varchar(128) DEFAULT '' NOT NULL,
+ timeout integer DEFAULT '30' NOT NULL,
+ posts blob DEFAULT '' NOT NULL,
+ required varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (httpstepid)
+);
+CREATE INDEX httpstep_httpstep_1 on httpstep (httptestid);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/httpstepitem.sql b/upgrades/dbpatches/1.3/mysql/patch/httpstepitem.sql
new file mode 100644
index 00000000..3a0fa50d
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/httpstepitem.sql
@@ -0,0 +1,8 @@
+CREATE TABLE httpstepitem (
+ httpstepitemid bigint unsigned DEFAULT '0' NOT NULL,
+ httpstepid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httpstepitemid)
+);
+CREATE UNIQUE INDEX httpstepitem_httpstepitem_1 on httpstepitem (httpstepid,itemid);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/httptest.sql b/upgrades/dbpatches/1.3/mysql/patch/httptest.sql
new file mode 100644
index 00000000..4197f377
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/httptest.sql
@@ -0,0 +1,17 @@
+CREATE TABLE httptest (
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ lastcheck integer DEFAULT '0' NOT NULL,
+ nextcheck integer DEFAULT '0' NOT NULL,
+ curstate integer DEFAULT '0' NOT NULL,
+ curstep integer DEFAULT '0' NOT NULL,
+ lastfailedstep bigint unsigned DEFAULT '0' NOT NULL,
+ delay integer DEFAULT '60' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ macros blob DEFAULT '' NOT NULL,
+ agent varchar(255) DEFAULT '' NOT NULL,
+ time double(16,4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httptestid)
+);
+CREATE INDEX httptest_httptest_1 on httptest (httptestid);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/httptestitem.sql b/upgrades/dbpatches/1.3/mysql/patch/httptestitem.sql
new file mode 100644
index 00000000..a8fa36d9
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/httptestitem.sql
@@ -0,0 +1,8 @@
+CREATE TABLE httptestitem (
+ httptestitemid bigint unsigned DEFAULT '0' NOT NULL,
+ httptestid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (httptestitemid)
+);
+CREATE UNIQUE INDEX httptestitem_httptestitem_1 on httptestitem (httptestid,itemid);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/images.sql b/upgrades/dbpatches/1.3/mysql/patch/images.sql
new file mode 100644
index 00000000..89819a8a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/images.sql
@@ -0,0 +1,12 @@
+CREATE TABLE images_tmp (
+ imageid bigint unsigned DEFAULT '0' NOT NULL,
+ imagetype integer DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '0' NOT NULL,
+ image longblob DEFAULT '' NOT NULL,
+ PRIMARY KEY (imageid)
+);
+CREATE INDEX images_1 on images_tmp (imagetype,name);
+
+insert into images_tmp select * from images`;
+drop table images;
+alter table images_tmp rename images;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/items.sql b/upgrades/dbpatches/1.3/mysql/patch/items.sql
new file mode 100644
index 00000000..94bd76b0
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/items.sql
@@ -0,0 +1,43 @@
+CREATE TABLE items_tmp (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ snmp_community varchar(64) DEFAULT '' NOT NULL,
+ snmp_oid varchar(255) DEFAULT '' NOT NULL,
+ snmp_port integer DEFAULT '161' NOT NULL,
+ hostid bigint unsigned DEFAULT '0' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ key_ varchar(255) DEFAULT '' NOT NULL,
+ delay integer DEFAULT '0' NOT NULL,
+ history integer DEFAULT '90' NOT NULL,
+ trends integer DEFAULT '365' NOT NULL,
+ nextcheck integer DEFAULT '0' NOT NULL,
+ lastvalue varchar(255) NULL,
+ lastclock integer NULL,
+ prevvalue varchar(255) NULL,
+ status integer DEFAULT '0' NOT NULL,
+ value_type integer DEFAULT '0' NOT NULL,
+ trapper_hosts varchar(255) DEFAULT '' NOT NULL,
+ units varchar(10) DEFAULT '' NOT NULL,
+ multiplier integer DEFAULT '0' NOT NULL,
+ delta integer DEFAULT '0' NOT NULL,
+ prevorgvalue varchar(255) NULL,
+ snmpv3_securityname varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_securitylevel integer DEFAULT '0' NOT NULL,
+ snmpv3_authpassphrase varchar(64) DEFAULT '' NOT NULL,
+ snmpv3_privpassphrase varchar(64) DEFAULT '' NOT NULL,
+ formula varchar(255) DEFAULT '0' NOT NULL,
+ error varchar(128) DEFAULT '' NOT NULL,
+ lastlogsize integer DEFAULT '0' NOT NULL,
+ logtimefmt varchar(64) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ delay_flex varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (itemid)
+);
+CREATE UNIQUE INDEX items_1 on items_tmp (hostid,key_);
+CREATE INDEX items_2 on items_tmp (nextcheck);
+CREATE INDEX items_3 on items_tmp (status);
+
+insert into items_tmp select *,'' from items;
+drop table items;
+alter table items_tmp rename items;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/items_applications.sql b/upgrades/dbpatches/1.3/mysql/patch/items_applications.sql
new file mode 100644
index 00000000..b426ea67
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/items_applications.sql
@@ -0,0 +1,23 @@
+CREATE TABLE items_applications_tmp (
+ itemappid bigint unsigned NOT NULL auto_increment,
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (itemappid)
+);
+CREATE INDEX items_applications_1 on items_applications_tmp (applicationid,itemid);
+
+insert into items_applications_tmp select NULL,applicationid,applicationid from items_applications;
+drop table items_applications;
+alter table items_applications_tmp rename items_applications;
+
+CREATE TABLE items_applications_tmp (
+ itemappid bigint unsigned DEFAULT '0' NOT NULL,
+ applicationid bigint unsigned DEFAULT '0' NOT NULL,
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (itemappid)
+);
+CREATE INDEX items_applications_1 on items_applications_tmp (applicationid,itemid);
+
+insert into items_applications_tmp select * from items_applications;
+drop table items_applications;
+alter table items_applications_tmp rename items_applications;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/mappings.sql b/upgrades/dbpatches/1.3/mysql/patch/mappings.sql
new file mode 100644
index 00000000..72029fbc
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/mappings.sql
@@ -0,0 +1,12 @@
+CREATE TABLE mappings_tmp (
+ mappingid bigint unsigned DEFAULT '0' NOT NULL,
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ value varchar(64) DEFAULT '' NOT NULL,
+ newvalue varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mappingid)
+);
+CREATE INDEX mappings_1 on mappings_tmp (valuemapid);
+
+insert into mappings_tmp select * from mappings;
+drop table mappings;
+alter table mappings_tmp rename mappings;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/media.sql b/upgrades/dbpatches/1.3/mysql/patch/media.sql
new file mode 100644
index 00000000..9824f68b
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/media.sql
@@ -0,0 +1,16 @@
+CREATE TABLE media_tmp (
+ mediaid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ sendto varchar(100) DEFAULT '' NOT NULL,
+ active integer DEFAULT '0' NOT NULL,
+ severity integer DEFAULT '63' NOT NULL,
+ period varchar(100) DEFAULT '1-7,00:00-23:59' NOT NULL,
+ PRIMARY KEY (mediaid)
+);
+CREATE INDEX media_1 on media_tmp (userid);
+CREATE INDEX media_2 on media_tmp (mediatypeid);
+
+insert into media_tmp select * from media;
+drop table media;
+alter table media_tmp rename media;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/media_type.sql b/upgrades/dbpatches/1.3/mysql/patch/media_type.sql
new file mode 100644
index 00000000..dccddeb0
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/media_type.sql
@@ -0,0 +1,15 @@
+CREATE TABLE media_type_tmp (
+ mediatypeid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ description varchar(100) DEFAULT '' NOT NULL,
+ smtp_server varchar(255) DEFAULT '' NOT NULL,
+ smtp_helo varchar(255) DEFAULT '' NOT NULL,
+ smtp_email varchar(255) DEFAULT '' NOT NULL,
+ exec_path varchar(255) DEFAULT '' NOT NULL,
+ gsm_modem varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (mediatypeid)
+);
+
+insert into media_type_tmp select * from media_type;
+drop table media_type;
+alter table media_type_tmp rename media_type;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/node_cksum.sql b/upgrades/dbpatches/1.3/mysql/patch/node_cksum.sql
new file mode 100644
index 00000000..cd675a76
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/node_cksum.sql
@@ -0,0 +1,11 @@
+CREATE TABLE node_cksum (
+ cksumid bigint unsigned DEFAULT '0' NOT NULL,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ fieldname varchar(64) DEFAULT '' NOT NULL,
+ recordid bigint unsigned DEFAULT '0' NOT NULL,
+ cksumtype integer DEFAULT '0' NOT NULL,
+ cksum char(32) DEFAULT '' NOT NULL,
+ PRIMARY KEY (cksumid)
+);
+CREATE INDEX node_cksum_cksum_1 on node_cksum (nodeid,tablename,fieldname,recordid,cksumtype);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/node_configlog.sql b/upgrades/dbpatches/1.3/mysql/patch/node_configlog.sql
new file mode 100644
index 00000000..f80f9b25
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/node_configlog.sql
@@ -0,0 +1,12 @@
+CREATE TABLE node_configlog (
+ conflogid bigint unsigned DEFAULT '0' NOT NULL,
+ nodeid bigint unsigned DEFAULT '0' NOT NULL,
+ tablename varchar(64) DEFAULT '' NOT NULL,
+ recordid bigint unsigned DEFAULT '0' NOT NULL,
+ operation integer DEFAULT '0' NOT NULL,
+ sync_master integer DEFAULT '0' NOT NULL,
+ sync_slave integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (nodeid,conflogid)
+);
+CREATE INDEX node_configlog_configlog_1 on node_configlog (conflogid);
+CREATE INDEX node_configlog_configlog_2 on node_configlog (nodeid,tablename);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/nodes.sql b/upgrades/dbpatches/1.3/mysql/patch/nodes.sql
new file mode 100644
index 00000000..88acf5ed
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/nodes.sql
@@ -0,0 +1,18 @@
+CREATE TABLE nodes (
+ nodeid integer DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '0' NOT NULL,
+ timezone integer DEFAULT '0' NOT NULL,
+ ip varchar(15) DEFAULT '' NOT NULL,
+ port integer DEFAULT '10051' NOT NULL,
+ slave_history integer DEFAULT '30' NOT NULL,
+ slave_trends integer DEFAULT '365' NOT NULL,
+ event_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ events_eventid bigint unsigned DEFAULT '0' NOT NULL,
+ alerts_alertid bigint unsigned DEFAULT '0' NOT NULL,
+ history_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ history_str_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ history_uint_lastid bigint unsigned DEFAULT '0' NOT NULL,
+ nodetype integer DEFAULT '0' NOT NULL,
+ masterid integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (nodeid)
+);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/profiles.sql b/upgrades/dbpatches/1.3/mysql/patch/profiles.sql
new file mode 100644
index 00000000..b7f4d690
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/profiles.sql
@@ -0,0 +1,27 @@
+CREATE TABLE profiles_tmp (
+ profileid bigint unsigned NOT NULL auto_increment,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ idx varchar(64) DEFAULT '' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ valuetype integer DEFAULT 0 NOT NULL,
+ PRIMARY KEY (profileid)
+);
+CREATE UNIQUE INDEX profiles_1 on profiles_tmp (userid,idx);
+
+insert into profiles_tmp select NULL,userid,idx,value,valuetype from profiles;
+drop table profiles;
+alter table profiles_tmp rename profiles;
+
+CREATE TABLE profiles_tmp (
+ profileid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ idx varchar(64) DEFAULT '' NOT NULL,
+ value varchar(255) DEFAULT '' NOT NULL,
+ valuetype integer DEFAULT 0 NOT NULL,
+ PRIMARY KEY (profileid)
+);
+CREATE UNIQUE INDEX profiles_1 on profiles_tmp (userid,idx);
+
+insert into profiles_tmp select * from profiles;
+drop table profiles;
+alter table profiles_tmp rename profiles;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/rights.sql b/upgrades/dbpatches/1.3/mysql/patch/rights.sql
new file mode 100644
index 00000000..45d46cb5
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/rights.sql
@@ -0,0 +1,13 @@
+CREATE TABLE rights_tmp (
+ rightid bigint unsigned DEFAULT '0' NOT NULL,
+ groupid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ permission integer DEFAULT '0' NOT NULL,
+ id bigint unsigned ,
+ PRIMARY KEY (rightid)
+);
+CREATE INDEX rights_1 on rights_tmp (groupid);
+
+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/screens.sql b/upgrades/dbpatches/1.3/mysql/patch/screens.sql
new file mode 100644
index 00000000..95a95626
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/screens.sql
@@ -0,0 +1,11 @@
+CREATE TABLE screens_tmp (
+ screenid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(255) DEFAULT 'Screen' NOT NULL,
+ hsize integer DEFAULT '1' NOT NULL,
+ vsize integer DEFAULT '1' NOT NULL,
+ PRIMARY KEY (screenid)
+);
+
+insert into screens_tmp select * from screens;
+drop table screens;
+alter table screens_tmp rename screens;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/screens_items.sql b/upgrades/dbpatches/1.3/mysql/patch/screens_items.sql
new file mode 100644
index 00000000..50e315cf
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/screens_items.sql
@@ -0,0 +1,45 @@
+CREATE TABLE screens_items_tmp (
+ screenitemid bigint unsigned NOT NULL auto_increment,
+ screenid bigint unsigned DEFAULT '0' NOT NULL,
+ resourcetype integer DEFAULT '0' NOT NULL,
+ resourceid bigint unsigned DEFAULT '0' NOT NULL,
+ width integer DEFAULT '320' NOT NULL,
+ height integer DEFAULT '200' NOT NULL,
+ x integer DEFAULT '0' NOT NULL,
+ y integer DEFAULT '0' NOT NULL,
+ colspan integer DEFAULT '0' NOT NULL,
+ rowspan integer DEFAULT '0' NOT NULL,
+ elements integer DEFAULT '25' NOT NULL,
+ valign integer DEFAULT '0' NOT NULL,
+ halign integer DEFAULT '0' NOT NULL,
+ style integer DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (screenitemid)
+);
+
+insert into screens_items_tmp select NULL,screenid,resourcetype,resourceid,width,height,x,y,colspan,rowspan,elements,valign,halign,style,url from screens_items;
+drop table screens_items;
+alter table screens_items_tmp rename screens_items;
+
+CREATE TABLE screens_items_tmp (
+ screenitemid bigint unsigned DEFAULT '0' NOT NULL,
+ screenid bigint unsigned DEFAULT '0' NOT NULL,
+ resourcetype integer DEFAULT '0' NOT NULL,
+ resourceid bigint unsigned DEFAULT '0' NOT NULL,
+ width integer DEFAULT '320' NOT NULL,
+ height integer DEFAULT '200' NOT NULL,
+ x integer DEFAULT '0' NOT NULL,
+ y integer DEFAULT '0' NOT NULL,
+ colspan integer DEFAULT '0' NOT NULL,
+ rowspan integer DEFAULT '0' NOT NULL,
+ elements integer DEFAULT '25' NOT NULL,
+ valign integer DEFAULT '0' NOT NULL,
+ halign integer DEFAULT '0' NOT NULL,
+ style integer DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (screenitemid)
+);
+
+insert into screens_items_tmp select * from screens_items;
+drop table screens_items;
+alter table screens_items_tmp rename screens_items;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/service_alarms.sql b/upgrades/dbpatches/1.3/mysql/patch/service_alarms.sql
new file mode 100644
index 00000000..06e50412
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/service_alarms.sql
@@ -0,0 +1,13 @@
+CREATE TABLE service_alarms_tmp (
+ servicealarmid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (servicealarmid)
+);
+CREATE INDEX service_alarms_1 on service_alarms_tmp (serviceid,clock);
+CREATE INDEX service_alarms_2 on service_alarms_tmp (clock);
+
+insert into service_alarms_tmp select * from service_alarms;
+drop table service_alarms;
+alter table service_alarms_tmp rename service_alarms;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/services.sql b/upgrades/dbpatches/1.3/mysql/patch/services.sql
new file mode 100644
index 00000000..a17b7c48
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/services.sql
@@ -0,0 +1,15 @@
+CREATE TABLE services_tmp (
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ algorithm integer DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned ,
+ showsla integer DEFAULT '0' NOT NULL,
+ goodsla double(5,2) DEFAULT '99.9' NOT NULL,
+ sortorder integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (serviceid)
+);
+
+insert into services_tmp select * from services;
+drop table services;
+alter table services_tmp rename services;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/services_links.sql b/upgrades/dbpatches/1.3/mysql/patch/services_links.sql
new file mode 100644
index 00000000..633f5d31
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/services_links.sql
@@ -0,0 +1,13 @@
+CREATE TABLE services_links_tmp (
+ linkid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceupid bigint unsigned DEFAULT '0' NOT NULL,
+ servicedownid bigint unsigned DEFAULT '0' NOT NULL,
+ soft integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (linkid)
+);
+CREATE INDEX services_links_links_1 on services_links_tmp (servicedownid);
+CREATE UNIQUE INDEX services_links_links_2 on services_links_tmp (serviceupid,servicedownid);
+
+insert into services_links_tmp select * from services_links;
+drop table services_links;
+alter table services_links_tmp rename services_links;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/services_times.sql b/upgrades/dbpatches/1.3/mysql/patch/services_times.sql
new file mode 100644
index 00000000..444a26d1
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/services_times.sql
@@ -0,0 +1,10 @@
+CREATE TABLE services_times (
+ timeid bigint unsigned DEFAULT '0' NOT NULL,
+ serviceid bigint unsigned DEFAULT '0' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ ts_from integer DEFAULT '0' NOT NULL,
+ ts_to integer DEFAULT '0' NOT NULL,
+ note varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (timeid)
+);
+CREATE INDEX services_times_times_1 on services_times (serviceid,type,ts_from,ts_to);
diff --git a/upgrades/dbpatches/1.3/mysql/patch/sessions.sql b/upgrades/dbpatches/1.3/mysql/patch/sessions.sql
new file mode 100644
index 00000000..fc47be47
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/sessions.sql
@@ -0,0 +1,10 @@
+CREATE TABLE sessions_tmp (
+ sessionid varchar(32) DEFAULT '' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ lastaccess integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (sessionid)
+);
+
+insert into sessions_tmp select * from sessions;
+drop table sessions;
+alter table sessions_tmp rename sessions;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql b/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql
new file mode 100644
index 00000000..2f8d2338
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/sysmaps.sql
@@ -0,0 +1,15 @@
+CREATE TABLE sysmaps_tmp (
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width integer DEFAULT '0' NOT NULL,
+ height integer DEFAULT '0' NOT NULL,
+ backgroundid bigint unsigned DEFAULT '0' NOT NULL,
+ label_type integer DEFAULT '0' NOT NULL,
+ label_location integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (sysmapid)
+);
+CREATE INDEX sysmaps_1 on sysmaps_tmp (name);
+
+insert into sysmaps_tmp select * from sysmaps;
+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
new file mode 100644
index 00000000..51d17c9e
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/sysmaps_elements.sql
@@ -0,0 +1,18 @@
+CREATE TABLE sysmaps_elements_tmp (
+ selementid bigint unsigned DEFAULT '0' NOT NULL,
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ elementid bigint unsigned DEFAULT '0' NOT NULL,
+ elementtype integer DEFAULT '0' NOT NULL,
+ iconid_off bigint unsigned DEFAULT '0' NOT NULL,
+ iconid_on bigint unsigned DEFAULT '0' NOT NULL,
+ label varchar(128) DEFAULT '' NOT NULL,
+ label_location integer NULL,
+ x integer DEFAULT '0' NOT NULL,
+ y integer DEFAULT '0' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ PRIMARY KEY (selementid)
+);
+
+insert into sysmaps_elements_tmp select * from sysmaps_elements;
+drop table sysmaps_elements;
+alter table sysmaps_elements_tmp rename sysmaps_elements;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/sysmaps_links.sql b/upgrades/dbpatches/1.3/mysql/patch/sysmaps_links.sql
new file mode 100644
index 00000000..d8818401
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/sysmaps_links.sql
@@ -0,0 +1,16 @@
+CREATE TABLE sysmaps_links_tmp (
+ linkid bigint unsigned DEFAULT '0' NOT NULL,
+ sysmapid bigint unsigned DEFAULT '0' NOT NULL,
+ selementid1 bigint unsigned DEFAULT '0' NOT NULL,
+ selementid2 bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid bigint unsigned ,
+ drawtype_off integer DEFAULT '0' NOT NULL,
+ color_off varchar(32) DEFAULT 'Black' NOT NULL,
+ drawtype_on integer DEFAULT '0' NOT NULL,
+ color_on varchar(32) DEFAULT 'Red' NOT NULL,
+ PRIMARY KEY (linkid)
+);
+
+insert into sysmaps_links_tmp select * from sysmaps_links;
+drop table sysmaps_links;
+alter table sysmaps_links_tmp rename sysmaps_links;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/trends.sql b/upgrades/dbpatches/1.3/mysql/patch/trends.sql
new file mode 100644
index 00000000..06bdafab
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/trends.sql
@@ -0,0 +1,13 @@
+CREATE TABLE trends_tmp (
+ itemid bigint unsigned DEFAULT '0' NOT NULL,
+ clock integer DEFAULT '0' NOT NULL,
+ num integer DEFAULT '0' NOT NULL,
+ value_min double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_avg double(16,4) DEFAULT '0.0000' NOT NULL,
+ value_max double(16,4) DEFAULT '0.0000' NOT NULL,
+ PRIMARY KEY (itemid,clock)
+);
+
+insert into trends_tmp select * from trends;
+drop table trends;
+alter table trends_tmp rename trends;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/trigger_depends.sql b/upgrades/dbpatches/1.3/mysql/patch/trigger_depends.sql
new file mode 100644
index 00000000..23ed223a
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/trigger_depends.sql
@@ -0,0 +1,25 @@
+CREATE TABLE trigger_depends_tmp (
+ triggerdepid bigint unsigned NOT NULL auto_increment,
+ triggerid_down bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid_up bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerdepid)
+);
+CREATE INDEX trigger_depends_1 on trigger_depends_tmp (triggerid_down,triggerid_up);
+CREATE INDEX trigger_depends_2 on trigger_depends_tmp (triggerid_up);
+
+insert into trigger_depends_tmp select NULL,triggerid_down,triggerid_up from trigger_depends;
+drop table trigger_depends;
+alter table trigger_depends_tmp rename trigger_depends;
+
+CREATE TABLE trigger_depends_tmp (
+ triggerdepid bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid_down bigint unsigned DEFAULT '0' NOT NULL,
+ triggerid_up bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerdepid)
+);
+CREATE INDEX trigger_depends_1 on trigger_depends_tmp (triggerid_down,triggerid_up);
+CREATE INDEX trigger_depends_2 on trigger_depends_tmp (triggerid_up);
+
+insert into trigger_depends_tmp select * from trigger_depends;
+drop table trigger_depends;
+alter table trigger_depends_tmp rename trigger_depends;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/triggers.sql b/upgrades/dbpatches/1.3/mysql/patch/triggers.sql
new file mode 100644
index 00000000..dd7d8171
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/triggers.sql
@@ -0,0 +1,21 @@
+CREATE TABLE triggers_tmp (
+ triggerid bigint unsigned DEFAULT '0' NOT NULL,
+ expression varchar(255) DEFAULT '' NOT NULL,
+ description varchar(255) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ status integer DEFAULT '0' NOT NULL,
+ value integer DEFAULT '0' NOT NULL,
+ priority integer DEFAULT '0' NOT NULL,
+ lastchange integer DEFAULT '0' NOT NULL,
+ dep_level integer DEFAULT '0' NOT NULL,
+ comments blob ,
+ error varchar(128) DEFAULT '' NOT NULL,
+ templateid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (triggerid)
+);
+CREATE INDEX triggers_1 on triggers_tmp (status);
+CREATE INDEX triggers_2 on triggers_tmp (value);
+
+insert into triggers_tmp select * from triggers;
+drop table triggers;
+alter table triggers_tmp rename triggers;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/users.sql b/upgrades/dbpatches/1.3/mysql/patch/users.sql
new file mode 100644
index 00000000..9d15cb91
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/users.sql
@@ -0,0 +1,18 @@
+CREATE TABLE users_tmp (
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ alias varchar(100) DEFAULT '' NOT NULL,
+ name varchar(100) DEFAULT '' NOT NULL,
+ surname varchar(100) DEFAULT '' NOT NULL,
+ passwd char(32) DEFAULT '' NOT NULL,
+ url varchar(255) DEFAULT '' NOT NULL,
+ autologout integer DEFAULT '900' NOT NULL,
+ lang varchar(5) DEFAULT 'en_gb' NOT NULL,
+ refresh integer DEFAULT '30' NOT NULL,
+ type integer DEFAULT '0' NOT NULL,
+ PRIMARY KEY (userid)
+);
+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;
+drop table users;
+alter table users_tmp rename users;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/users_groups.sql b/upgrades/dbpatches/1.3/mysql/patch/users_groups.sql
new file mode 100644
index 00000000..41bf0c6f
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/users_groups.sql
@@ -0,0 +1,23 @@
+CREATE TABLE users_groups_tmp (
+ id bigint unsigned NOT NULL auto_increment,
+ usrgrpid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX users_groups_1 on users_groups_tmp (usrgrpid,userid);
+
+insert into users_groups_tmp select NULL,usrgrpid,userid from users_groups;
+drop table users_groups;
+alter table users_groups_tmp rename users_groups;
+
+CREATE TABLE users_groups_tmp (
+ id bigint unsigned DEFAULT '0' NOT NULL,
+ usrgrpid bigint unsigned DEFAULT '0' NOT NULL,
+ userid bigint unsigned DEFAULT '0' NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE INDEX users_groups_1 on users_groups_tmp (usrgrpid,userid);
+
+insert into users_groups_tmp select * from users_groups;
+drop table users_groups;
+alter table users_groups_tmp rename users_groups;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/usrgrp.sql b/upgrades/dbpatches/1.3/mysql/patch/usrgrp.sql
new file mode 100644
index 00000000..2106ddfb
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/usrgrp.sql
@@ -0,0 +1,10 @@
+CREATE TABLE usrgrp_tmp (
+ usrgrpid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (usrgrpid)
+);
+CREATE INDEX usrgrp_1 on usrgrp (name);
+
+insert into usrgrp_tmp select * from usrgrp;
+drop table usrgrp;
+alter table usrgrp_tmp rename usrgrp;
diff --git a/upgrades/dbpatches/1.3/mysql/patch/valuemaps.sql b/upgrades/dbpatches/1.3/mysql/patch/valuemaps.sql
new file mode 100644
index 00000000..296faa8e
--- /dev/null
+++ b/upgrades/dbpatches/1.3/mysql/patch/valuemaps.sql
@@ -0,0 +1,10 @@
+CREATE TABLE valuemaps_tmp (
+ valuemapid bigint unsigned DEFAULT '0' NOT NULL,
+ name varchar(64) DEFAULT '' NOT NULL,
+ PRIMARY KEY (valuemapid)
+);
+CREATE INDEX valuemaps_1 on valuemaps_tmp (name);
+
+insert into valuemaps_tmp select * from valuemaps;
+drop table valuemaps;
+alter table valuemaps_tmp rename valuemaps;