All of the move_* methods automatically update the rows involved in the query. This is not configurable and is due to the fact that if you move a record it always causes other records in the list to be updated.

This method specifies a value of "position_column" which would never be assigned to a row during normal operation. When a row is moved, its position is set to this value temporarily, so that any unique constraints can not be violated. This value defaults to 0, which should work for all cases except when your positions do indeed start from 0.

Moves the object to the specified position of the specified group, or to the end of the group if $position is undef. 1 is returned on success, and 0 is returned if the object is already at the specified position of the specified group.

$group may be specified as a single scalar if only one grouping column is in use, or as a hashref of column => value pairs if multiple grouping columns are in use.

Overrides the DBIC update() method by checking for a change to the position and/or group columns. Movement within a group or to another group is handled by repositioning the appropriate siblings. Position defaults to the end of a new group if it has been changed to undef.

You would want to override the methods below if you use sparse (non-linear) or non-numeric position values. This can be useful if you are working with preexisting non-normalised position data, or if you need to work with materialized path columns.

This method specifies a value of "position_column" which is assigned to the first inserted element of a group, if no value was supplied at insertion time. All subsequent values are derived from this one by "_next_position_value" below. Defaults to 1.

Returns a position value that would be considered next with regards to $position_value. Can be pretty much anything, given that $position_value < $new_value where < is the SQL comparison operator (usually works fine on strings). The default method expects $position_value to be numeric, and returns $position_value + 1

Shifts all siblings with positions values in the range @between (inclusive) by one position as specified by $direction (left if < 0, right if > 0). By default simply increments/decrements each "position_column" value by 1, doing so in a way as to not violate any existing constraints.

Note that if you override this method and have unique constraints including the "position_column" the shift is not a trivial task. Refer to the implementation source of the default method for more information.

Note that all Insert/Create/Delete overrides are happening on DBIx::Class::Row methods only. If you use the DBIx::Class::ResultSet versions of update or delete, all logic present in this module will be bypassed entirely (possibly resulting in a broken order-tree). Instead always use the update_all and delete_all methods, which will invoke the corresponding row method on every member of the given resultset.

If a position is not specified for an insert, a position will be chosen based either on "_initial_position_value" or "_next_position_value", depending if there are already some items in the current group. The space of time between the necessary selects and insert introduces a race condition. Having unique constraints on your position/group columns, and using transactions (see "txn_do" in DBIx::Class::Storage) will prevent such race conditions going undetected.

Be careful when issuing move_* methods to multiple objects. If you've pre-loaded the objects then when you move one of the objects the position of the other object will not reflect their new value until you reload them from the database - see "discard_changes" in DBIx::Class::Row.

There are times when you will want to move objects as groups, such as changing the parent of several objects at once - this directly conflicts with this problem. One solution is for us to write a ResultSet class that supports a parent() method, for example. Another solution is to somehow automagically modify the objects that exist in the current object's result set to have the new position value.