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>
Fri, 10 Apr 2015 21:16:44 +0000 (23:16 +0200)
commit5dfc3b28b3b79466b2ec1c4ee6e4bc999f2656df
tree2b35b0fb15bf195f8e2943e43df5678fe66d9967
parent3a3c02959ef5d544627fee776e0eba866b82b305
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