Fix unstable "before" moving of policies.

This ensures that policy movement is stable when trying to place one policy
ahead of another in the database.  Previously it would incorrectly swap the
two policies regardless of relative position; now it is correctly idempotent.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>