Source
/* sysmaps_elements.elementid for trigger map elements (2) should be migrated to table sysmap_element_trigger */
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* 3.4 development database patches
*/
static int DBpatch_3030000(void)
{
const ZBX_FIELD field = {"ipmi_authtype", "-1", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0};
return DBset_default("hosts", &field);
}
static int DBpatch_3030001(void)
{
const ZBX_FIELD field = {"snmp_oid", "", NULL, NULL, 512, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("items", &field, NULL);
}
static int DBpatch_3030002(void)
{
const ZBX_FIELD field = {"key_", "", NULL, NULL, 512, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
return DBmodify_field_type("dchecks", &field, NULL);
}
static int DBpatch_3030003(void)
{
return DBdrop_field("proxy_dhistory", "type");
}
static int DBpatch_3030004(void)
{
return DBdrop_field("proxy_dhistory", "key_");
}
static int DBpatch_3030005(void)
{
return DBdrop_foreign_key("dservices", 2);
}
static int DBpatch_3030006(void)
{
return DBdrop_index("dservices", "dservices_1");
}
static int DBpatch_3030007(void)
{
DB_ROW row;
DB_RESULT result;
zbx_vector_uint64_t dserviceids;
zbx_uint64_t dserviceid;
int ret = SUCCEED;
zbx_vector_uint64_create(&dserviceids);
/* After dropping fields type and key_ from table dservices there is no guarantee that a unique
index with fields dcheckid, ip and port can be created. To create a unique index for the same
fields later this will delete rows where all three of them are identical only leaving the latest. */
result = zbx_db_select(
"select ds.dserviceid"
" from dservices ds"
" where not exists ("
"select null"
" from dchecks dc"