-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Added command to fix bulk checkin action log entries #16500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Summary
|
@snipe one question: should I include doing a backup before actually updating the logs? |
This looks great, thank you @marcusmoore! Regarding your question, I think maybe backing up by default but allowing a |
Sounds good. I'll add that. |
@snipe added automatic backup with option to skip via |
Background
A recent PR, #16489, fixed an issue where
action_logs.created_by
was being recorded as null andaction_logs.created_at
was being recorded incorrectly when bulk checking in accessories (other bulk checkin entries recorded correctly).This PR
This PR adds a command,
snipeit:fix-bulk-accessory-action-log-entries
, to fix bothcreated_at
andcreated_by
for the entries mentioned above.created_at
was being recorded as~1970-01-01 00:00:01
and sinceupdated_at
was recorded correctly, we can usecreated_at
being in1970
as a way to updatecreated_at
to theupdated_at
timestamp.created_by
is a little more tricky. Since other bulk checkins were being recorded correctly, this command looks to find theuser_id
by using each action log entry that has the 1970s issue mentioned above to find a matching log entry that hascreated_by
populated. Put another way, if a user did a bulk checkin including accessories, wherecreated_at
andcreated_by
would be incorrect, and the checkin also included checkins for assets, licenses, etc, we can use those entries to populatecreated_by
.Example output from a dry-run: