Upgrade: Fix `value` for added `option_value` entries in various places
authorOlaf Buddenhagen <antrik@digitalcourage.de>
Thu, 9 Apr 2015 22:16:54 +0000 (00:16 +0200)
committerOlaf Buddenhagen <antrik@digitalcourage.de>
Thu, 9 Apr 2015 22:42:57 +0000 (00:42 +0200)
commit7d25d598940652b2ae1ae4acad47588d5ec81bec
treed924426b4e5f84e6ed5385d410f25acb4b0128b8
parentd4d5f4cbfbd386cb5c7cbbea6ad7e4da2811d6d6
Upgrade: Fix `value` for added `option_value` entries in various places

In several places, the highest existing option value for a group was
being determined using max(value), which breaks as soon as there are
values above 9, because `value` is defined as a varchar rather than
integer for lulz. In most instances, this is taken care of by using
max(round(value)) instead -- but not everwhere. Fix the wrong ones.

(BTW, convert(value, decimal) would be more obvious than round()
IMHO...)

Note that while this patch is against master, it should be backported to
all maintained branches.

PS. Database normalisation is only for wimps who can't handle the
anomalies, right?...
CRM/Upgrade/Incremental/sql/3.4.alpha1.mysql.tpl
CRM/Upgrade/Incremental/sql/4.3.alpha1.mysql.tpl
CRM/Upgrade/Incremental/sql/4.4.5.mysql.tpl
CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl
CRM/Upgrade/Incremental/sql/4.6.alpha1.mysql.tpl