-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New command to delete contact fields in background #14679
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 7.x #14679 +/- ##
============================================
+ Coverage 64.68% 64.70% +0.02%
- Complexity 34686 34736 +50
============================================
Files 2274 2279 +5
Lines 103607 103738 +131
============================================
+ Hits 67015 67123 +108
- Misses 36592 36615 +23
🚀 New features to boost your workflow:
|
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.
Thanks @escopecz!. LGTM.
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.
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
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 did basic tests with flag true/false.
Works as expected.
Code seems legit 👍
This should be ready to merge once #14690 is merged. |
…-queries Maut 3943 long running queries
Description
This PR is adding a new command to delete custom fields by a command that can be run as a cron job the same as the existing commands that create and update custom fields.
This is the new command:
bin/console mautic:custom-field:delete-column --id=[FIELD ID] --user=[USER ID]
If the FIELD ID is not provided, the command will look for fields that were soft-deleted (will be when
create_custom_field_in_background
is ON). If the USER ID is not provided, the user who modified the custom field the last when they were soft-deleting the field will be used.There is no change for normal Mautic instances. This command is necessary only for Mautic instances with big
leads
database tables and busy traffic. Such instances should have thecreate_custom_field_in_background
option set to true and use the background commands to manage custom fields as it modifies theleads
table schema which is an expensive (read slow) operation and long running queries on that table while performing the schema change can time out and it could lead to data loss.📋 Steps to test this PR:
leads
table is getting updated with those changes.config/local.php
file:'create_custom_field_in_background' => true,
and clear the cache withrm -rf var/cache/*
bin/console mautic:custom-field:delete-column
. Even without the ID the command will find the soft-deleted field and remove it. Only after the command execution the field row in thelead_fleds
table is removed and the column in theleads
table is removed.