Skip to content

Revert Cancel Positions ΒΆ

Initially, shifts that were ‘canceled’ had their position type changed to ‘cancel’. This lost information.

In Jan 2020, audit logging was added to log data changes.

In support of CATS-77, we have a command to perform a one time reversion of any shifts with ‘cancel’ to their original position type from data in the ‘audits’ table. This will not transform any shift position data from 2019.

Core command is an artisan command, and could be run from CLI.

> php artisan revert:cancelpositions

Should only need to be run once.

NOTE: there is also a check at the top of the GeneralController::migrateShiftPositions method that checks for ‘revertable’ cancel positions, and will show a button to trigger the artisan command from the migrate shift positions web screen.

NOTE 2: the code is checking for ‘position_id’ of ‘1’ - the original ‘cancel’ position. This is hardcoded in, because production has this hard coded. PR/test environments may have ‘Exams’ or something else as position_id 1, but the screens will still reference the word ‘cancel’.

After this, any shifts with ‘Cancel’ position can be migrated to ‘Exams’ type with the position migration tool. This will not be 100% accurate, but ‘Exams’ were the most common.

After these steps, the ‘Cancel’ position can be deleted entirely.