When scaling down a unit, the relation departed/broken event is triggered. This causes the unit to try to remove the migration version from the peer databag. If the unit is not the leader then this raises an error.
This is also wrong because if the unit is scaled down, then it should not try to clean up the migration version as other units are still connected with the database.
Bug Description
When scaling down a unit, the relation departed/broken event is triggered. This causes the unit to try to remove the migration version from the peer databag. If the unit is not the leader then this raises an error.
This is also wrong because if the unit is scaled down, then it should not try to clean up the migration version as other units are still connected with the database.
To Reproduce
juju scale-application hydra 3 juju scale-application hydra 1