Created
March 19, 2018 22:36
-
-
Save ipascual/5aa88406e48dfa74a9eab62ead07374d to your computer and use it in GitHub Desktop.
magento2 - delete invoices SQL
This file contains 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
fromInvoiceId = 418 | |
fromOrderId = 371 | |
DELETE FROM sales_invoice WHERE entity_id >= 418; | |
ALTER TABLE sales_invoice AUTO_INCREMENT = 418; | |
DELETE FROM sales_invoice_grid WHERE entity_id >= 418; | |
ALTER TABLE sales_invoice_grid AUTO_INCREMENT = 418; | |
DELETE FROM sales_invoice_item WHERE parent_id >= 418; | |
ALTER TABLE sales_invoice_item AUTO_INCREMENT = 418; | |
DELETE FROM sequence_invoice_1 WHERE sequence_value >= 418; | |
ALTER TABLE sequence_invoice_1 AUTO_INCREMENT = 418; | |
UPDATE sales_order | |
SET base_discount_invoiced=0, | |
base_shipping_invoiced=0, | |
base_subtotal_invoiced=0, | |
base_tax_invoiced=0, | |
base_total_invoiced_cost=0, | |
base_total_invoiced=0, | |
discount_invoiced=0, | |
shipping_invoiced=0, | |
subtotal_invoiced=0, | |
tax_invoiced=0, | |
total_invoiced=0 | |
WHERE entity_id >=371; | |
UPDATE sales_order_item | |
SET qty_invoiced=0, | |
tax_invoiced =0, | |
base_tax_invoiced=0, | |
discount_invoiced =0, | |
base_discount_invoiced=0, | |
row_invoiced = 0, | |
base_row_invoiced=0, | |
locked_do_invoice=0, | |
discount_tax_compensation_invoiced = 0, | |
base_discount_tax_compensation_invoiced = 0 | |
WHERE order_id >= 371; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment