-
Notifications
You must be signed in to change notification settings - Fork 9.4k
SQLSTATE[23000]: Integrity constraint violation:
error while running sales_clean_orders
cron job
#35302
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
Comments
Hi @Usik2203. Thank you for your report.
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
For more details, review the Magento Contributor Assistant documentation. Add a comment to assign the issue: To learn more about issue processing workflow, refer to the Code Contributions.
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento I am working on this |
@magento give me 2.4-develop instance |
Hi @tuyennn. Thank you for your request. I'm working on Magento instance for you. |
Hi @tuyennn, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
@magento give me 2.4-develop instance |
Hi @tuyennn. Thank you for your request. I'm working on Magento instance for you. |
Hi @tuyennn, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
Preconditions (*)
I see next error while running
sales_clean_orders
cron jobSQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
magento2.
salesrule_customer, CONSTRAINT
SALESRULE_CUSTOMER_RULE_ID_SALESRULE_RULE_IDFOREIGN KEY (
rule_id) REFERENCES
salesrule(
rule_id) ON DELETE CASCADE), query was: INSERT INTO
salesrule_customer() VALUES ()
Steps to reproduce (*)
1. Set








Pending Payment Order Lifetime (minutes)
to1
2. Set schedule for
sales_clean_orders
to* * * * *
inapp/code/Magento/Sales/etc/crontab.xml:14
3. Create
Cart Price Rule
4. Login as Customer and place order with applied
Cart Price Rule
5 Go to
sales_order
table and set statuspending_payment
for current order6 Go Marketing -> Cart Price Rule and remove
Cart Price Rule
6 Go to console and run
bin/magento cron:run --group="default"
7 Go to
cron_schedule
table you will seeSQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
magento2.
salesrule_customer, CONSTRAINT
SALESRULE_CUSTOMER_RULE_ID_SALESRULE_RULE_IDFOREIGN KEY (
rule_id) REFERENCES
salesrule(
rule_id) ON DELETE CASCADE), query was: INSERT INTO
salesrule_customer() VALUES ()
Expected result (*)
I don't see mentioned error while running
sales_clean_orders
cron jobActual result (*)
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
magento2.
salesrule_customer, CONSTRAINT
SALESRULE_CUSTOMER_RULE_ID_SALESRULE_RULE_IDFOREIGN KEY (
rule_id) REFERENCES
salesrule(
rule_id) ON DELETE CASCADE), query was: INSERT INTO
salesrule_customer() VALUES ()
Related issues(*)
#27918
#19230
#16779
The text was updated successfully, but these errors were encountered: