-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Actiontype enum redux #18141
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
Merged
+73
−4
Merged
Actiontype enum redux #18141
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b96e2fb
Added migration to fix incorrect action_type in action_log
uberbrady 2de66ad
Merge branch 'fix_incorrect_action_types' into actiontype_enum_redux
uberbrady f7bc538
Intorduce ActionType enum and ensure all logactions are using it
uberbrady 27d7449
Fix comment to properly reflext the current state of the database
uberbrady File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| <?php | ||
|
|
||
| namespace App\Enums; | ||
| enum ActionType: string | ||
| { | ||
| // General | ||
| case Create = 'create'; | ||
| case Update = 'update'; | ||
| case Delete = 'delete'; | ||
| case Restore = 'restore'; | ||
|
|
||
| // Assets/Accessories/Components/Licenses/Consumables | ||
| case Checkout = 'checkout'; | ||
| case CheckinFrom = 'checkin from'; | ||
| case Requested = 'requested'; | ||
| case RequestCanceled = 'request canceled'; | ||
| case Accepted = 'accepted'; | ||
| case Declined = 'declined'; | ||
| case Audit = 'audit'; | ||
| case NoteAdded = 'note added'; | ||
|
|
||
| // Users | ||
| case TwoFactorReset = '2FA reset'; | ||
| case Merged = 'merged'; | ||
|
|
||
| // Licenses | ||
| case DeleteSeats = 'delete seats'; | ||
| case AddSeats = 'add seats'; | ||
|
|
||
| // File Uploads | ||
| case Uploaded = 'uploaded'; | ||
| case UploadDeleted = 'upload deleted'; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
database/migrations/2025_10_22_144927_migrate_incorrect_action_types.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| */ | ||
| public function up(): void | ||
| { | ||
|
|
||
| /** | ||
| * We actually *do* have an index on action_type, so this query shouldn't take too terribly long. I don't know | ||
| * that we have a ton of people canceling requests (and only certain types of request-cancellation use this | ||
| * erroneous action_type), so I feel pretty comfortable with this fixup. Fingers crossed! | ||
| * */ | ||
|
|
||
| DB::table('action_logs')->where('action_type', 'request_canceled')->update(['action_type' => 'request canceled']); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| */ | ||
| public function down(): void | ||
| { | ||
| // no down migration for this one | ||
| } | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that we're keeping the existing behavior around (passing in a string) while also checking that the string is a valid type using
::from👍🏾