-
New Feature
-
Resolution: Fixed
-
Blocker
-
2.6.1
-
MOODLE_26_STABLE
-
MOODLE_27_STABLE
-
Suppose we have a DB table like
Unique index
|
including these cols
|
v v
|
---------------------------
|
id | otherid | sortorder | ...
|
---------------------------
|
123 | 2345 | 1 | ...
|
45 | 2345 | 2 | ...
|
67 | 2345 | 3 | ...
|
890 | 2345 | 4 | ...
|
... other rows relating to other otherids ...
|
And suppose you want to re-order the sortorders like
1 => 4
2 => 1
3 => 3
4 => 2
You need to do this in the right order, so as to avoid violiating the unique index at any stage.
I am about to implement this for the second time, so I plan to do it as a utility method.