-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Converting the Change Increment ID KB to devdocs #5129
Changes from 11 commits
42d4cc0
b4076c0
3767649
cf2e890
30981b0
ebe870c
8298009
10b69d0
0984bab
417e2db
ce920bc
5d036a4
4a066cb
92cbd1e
0b63b1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,84 @@ | ||||||
--- | ||||||
group: configuration-guide | ||||||
title: Change increment ID for a database entity on particular store | ||||||
functional_areas: | ||||||
- Configuration | ||||||
- System | ||||||
- Setup | ||||||
--- | ||||||
|
||||||
This article discusses how to change the increment ID for a Magento database (DB) entity (order, invoice, credit memo, etc.) on a particular Magento store using the `ALTER TABLE` SQL statement. | ||||||
|
||||||
## Affected versions | ||||||
|
||||||
- Magento Commerce (on premise): 2.x.x | ||||||
- Magento Commerce (Cloud): 2.x.x | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace Magento Commerce (Cloud) with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Converted. |
||||||
- MySQL: any supported version | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a link to the topic that lists the supported versions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good. |
||||||
|
||||||
## When would you need to change increment ID | ||||||
|
||||||
You might need to change the increment ID for new DB entities in these cases: | ||||||
|
||||||
- After a hard backup restore on a Live site | ||||||
- Some order records have been lost, but their IDs are already being used by payment gateways (like PayPal) for your current Merchant account. Such being the case, the payment gateways stop processing new orders that have the same IDs, returning the "Duplicate invoice id" error | ||||||
|
||||||
{: .bs-callout-info} | ||||||
You may also fix the payment gateway issue for PayPal by allowing multiple payments per invoice ID in PayPal's Payment Receiving Preferences. See the Knowledge Base article: [PayPal gateway rejected request - duplicate invoice issue][] . | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed! |
||||||
|
||||||
## Prerequisite steps | ||||||
|
||||||
1. Find stores and entities for which the new increment ID should be changed. | ||||||
1. Connect to your MySQL DB. | ||||||
For Magento Commerce (Cloud), at first, you need to SSH to your environment. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable for Magento Commerce cloud is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||||||
1. Check the current auto_increment value for the entity sequence table using the following query: | ||||||
|
||||||
```sql | ||||||
SHOW TABLE STATUS FROM `{database_name}` WHERE `name` LIKE 'sequence_{entity_type}_{store_id}'; | ||||||
``` | ||||||
|
||||||
## Example | ||||||
|
||||||
If you are checking an auto increment for an order on the store with ID=1, the table name would be 'sequence_order_1'. | ||||||
|
||||||
If the value of the `auto_increment` column is '1234', the next order placed at the store with `ID=1` will have the ID '#100001234'. | ||||||
|
||||||
## Update entity to change increment ID | ||||||
|
||||||
Update the entity using the following query: | ||||||
|
||||||
```sql | ||||||
ALTER TABLE sequence_{entity_type}_{store_id} AUTO_INCREMENT = {new_increment_value}; | ||||||
``` | ||||||
|
||||||
{: .bs-callout-info} | ||||||
Important: The new increment value must be greater than the current one, not less. | ||||||
|
||||||
## Example | ||||||
|
||||||
After executing the following query: | ||||||
|
||||||
```sql | ||||||
ALTER TABLE sequence_order_1 AUTO_INCREMENT = 2000; | ||||||
``` | ||||||
|
||||||
The next order placed at the store with `ID=1` will have the ID '#100002000'. | ||||||
|
||||||
## Additional recommended steps on production environments (cloud) | ||||||
|
||||||
Before executing the `ALTER TABLE` query on a production environment of Magento Commerce (Cloud), we strongly recommend performing these steps: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable for cloud... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup |
||||||
|
||||||
- Test the entire procedure of changing the increment ID on your Staging environment | ||||||
- [Create a DB backup][] to restore your Production DB in case of failure | ||||||
|
||||||
## Related documentation | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boo...these related sections are draining and prone to URL maintenance. I would work links in to the content where it is relevant, or remove them completely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think they are ok. |
||||||
|
||||||
- [Set up a remote MySQL database connection][] | ||||||
- [Create database dump on Cloud][] | ||||||
- [SSH to your environment][] | ||||||
|
||||||
<!-- Link Definitions --> | ||||||
[PayPal gateway rejected request - duplicate invoice issue]: https://support.magento.com/hc/en-us/articles/115002457473 | ||||||
[Set up a remote MySQL database connection]: {{ page.baseurl }}/install-gde/prereq/mysql_remote.html | ||||||
[Create a DB backup]: https://support.magento.com/hc/en-us/articles/360003254334 | ||||||
[Create database dump on Cloud]: https://support.magento.com/hc/en-us/articles/360003254334 | ||||||
[SSH to your environment]: {{ page.baseurl }}/cloud/env/environments-ssh.html#ssh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
group: configuration-guide | ||
title: Change increment ID for a database entity on particular store | ||
functional_areas: | ||
- Configuration | ||
- System | ||
- Setup | ||
--- | ||
|
||
This article discusses how to change the increment ID for a Magento database (DB) entity (order, invoice, credit memo, etc.) on a particular Magento store using the `ALTER TABLE` SQL statement. | ||
|
||
## Affected versions | ||
|
||
- Magento Commerce (on premise): 2.x.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace Magento Commerce with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
- Magento Commerce (Cloud): 2.x.x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace Magento Commerce (Cloud) with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
- MySQL: any supported version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a link to the topic and section that lists supported versions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
## When would you need to change increment ID | ||
|
||
You might need to change the increment ID for new DB entities in these cases: | ||
|
||
- After a hard backup restore on a Live site | ||
- Some order records have been lost, but their IDs are already being used by payment gateways (like PayPal) for your current Merchant account. Such being the case, the payment gateways stop processing new orders that have the same IDs, returning the "Duplicate invoice id" error | ||
|
||
{: .bs-callout-info} | ||
You may also fix the payment gateway issue for PayPal by allowing multiple payments per invoice ID in PayPal's Payment Receiving Preferences. See the Knowledge Base article: [PayPal gateway rejected request - duplicate invoice issue][] . | ||
|
||
## Prerequisite steps | ||
|
||
1. Find stores and entities for which the new increment ID should be changed. | ||
1. Connect to your MySQL DB. | ||
For Magento Commerce (Cloud), at first, you need to SSH to your environment. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to SSH -> to connect using SSH There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace Magento Commerce (Cloud) with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dun and Dun |
||
1. Check the current auto_increment value for the entity sequence table using the following query: | ||
|
||
```sql | ||
SHOW TABLE STATUS FROM `{database_name}` WHERE `name` LIKE 'sequence_{entity_type}_{store_id}'; | ||
``` | ||
|
||
## Example | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two Example sections of the same highest level in the topic. This doesn't seem right. I assume that they should be converted to subsections, or be more verbose than just Example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed them. |
||
|
||
If you are checking an auto increment for an order on the store with ID=1, the table name would be 'sequence_order_1'. | ||
|
||
If the value of the `auto_increment` column is '1234', the next order placed at the store with `ID=1` will have the ID '#100001234'. | ||
|
||
## Update entity to change increment ID | ||
|
||
Update the entity using the following query: | ||
|
||
```sql | ||
ALTER TABLE sequence_{entity_type}_{store_id} AUTO_INCREMENT = {new_increment_value}; | ||
``` | ||
|
||
{: .bs-callout-info} | ||
Important: The new increment value must be greater than the current one, not less. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove , not less There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
|
||
## Example | ||
|
||
After executing the following query: | ||
|
||
```sql | ||
ALTER TABLE sequence_order_1 AUTO_INCREMENT = 2000; | ||
``` | ||
|
||
The next order placed at the store with `ID=1` will have the ID '#100002000'. | ||
|
||
## Additional recommended steps on production environments (cloud) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cloud -> Cloud There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use cloud in parenthesis. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nobody puts baby in the corner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😜 |
||
|
||
Before executing the `ALTER TABLE` query on a production environment of Magento Commerce (Cloud), we strongly recommend performing these steps: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace Magento Commerce (Cloud) with a variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
|
||
- Test the entire procedure of changing the increment ID on your Staging environment | ||
- [Create a DB backup][] to restore your Production DB in case of failure | ||
|
||
## Related documentation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Boo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping it. |
||
|
||
- [Set up a remote MySQL database connection][] | ||
- [Create database dump on Cloud][] | ||
- [SSH to your environment][] | ||
|
||
<!-- Link Definitions --> | ||
[PayPal gateway rejected request - duplicate invoice issue]: https://support.magento.com/hc/en-us/articles/115002457473 | ||
[Set up a remote MySQL database connection]: {{ page.baseurl }}/install-gde/prereq/mysql_remote.html | ||
[Create a DB backup]: https://support.magento.com/hc/en-us/articles/360003254334 | ||
[Create database dump on Cloud]: https://support.magento.com/hc/en-us/articles/360003254334 | ||
[SSH to your environment]: {{ page.baseurl }}/cloud/env/environments-ssh.html#ssh |
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.
replace Magento Commerce with a variable
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.
Done