Source
if (ZBX_DB_OK > zbx_db_execute("update services set algorithm=case algorithm when 1 then 2 when 2 then 1 else 0 end"))
/*
** 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.
**/
/*
* 6.0 development database patches
*/
static int DBpatch_5050001(void)
{
const ZBX_TABLE table =
{"service_problem_tag", "service_problem_tagid", 0,
{
{"service_problem_tagid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"serviceid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"tag", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{"operator", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{"value", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_5050002(void)
{
const ZBX_FIELD field = {"serviceid", NULL, "services", "serviceid", 0, 0, 0, ZBX_FK_CASCADE_DELETE};
return DBadd_foreign_key("service_problem_tag", 1, &field);
}
static int DBpatch_5050003(void)
{
return DBcreate_index("service_problem_tag", "service_problem_tag_1", "serviceid", 0);
}
static int DBpatch_5050004(void)
{
const ZBX_TABLE table =
{"service_problem", "service_problemid", 0,
{
{"service_problemid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"eventid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"serviceid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"severity", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{0}
},
NULL
};
return DBcreate_table(&table);
}
static int DBpatch_5050005(void)
{
return DBcreate_index("service_problem", "service_problem_1", "eventid", 0);
}
static int DBpatch_5050006(void)
{
return DBcreate_index("service_problem", "service_problem_2", "serviceid", 0);
}
static int DBpatch_5050007(void)