Above error occurs when there is missing tables for multi-stores. The main reason behind the issue is when the migration is done using any third party extension not done by Data migration tool.
NOTE: Please take backup of database before applying any changes!
You will notice that, following tables may be Missing:
Assumption: store 1, store 2 are working fine, if store 3 is not functioning properly.
If store 3 is not working properly then these tables need to be created:
sequence_creditmemo_3 sequence_invoice_3 sequence_order_3 sequence_shipment_3
NOTE: You can get structure of these tables from other existing tables like sequence_creditmemo_1 , sequence_invoice_1 , sequence_order_1 , sequence_shipment_1
NOTE: Need to change store id in table name.
CREATE TABLE `sequence_creditmemo_7` (`sequence_value` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_invoice_7` (`sequence_value` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_order_7` (`sequence_value` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `sequence_shipment_7` (`sequence_value` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `sequence_creditmemo_7`
ADD PRIMARY KEY (`sequence_value`);
ALTER TABLE `sequence_invoice_7`
ADD PRIMARY KEY (`sequence_value`);
ALTER TABLE `sequence_order_7`
ADD PRIMARY KEY (`sequence_value`);
ALTER TABLE `sequence_shipment_7`
ADD PRIMARY KEY (`sequence_value`);
ALTER TABLE `sequence_creditmemo_7`
MODIFY `sequence_value` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `sequence_invoice_7`
MODIFY `sequence_value` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `sequence_order_7`
MODIFY `sequence_value` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE `sequence_shipment_7`
MODIFY `sequence_value` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
Following tables need to be updated with the corresponding sequence profile table entries:
sales_sequence_meta sales_sequence_profile
Note: Need to change store id in below queries.
INSERT INTO `sales_sequence_meta` (`meta_id`, `entity_type`, `store_id`, `sequence_table`) VALUES (NULL, 'order', 7, 'sequence_order_7'), (NULL, 'invoice', 7, 'sequence_invoice_7'), (NULL, 'creditmemo', 7, 'sequence_creditmemo_7'), (NULL, 'shipment', 7, 'sequence_shipment_7')
Note: Change prefix as store id for below query.
INSERT INTO `sales_sequence_profile` (`profile_id`, `meta_id`, `prefix`, `suffix`, `start_value`, `step`, `max_value`, `warning_value`, `is_active`) VALUES (NULL, 25, 7, NULL, 1, 1, 4294967295, 4294966295, 1), (NULL, 26, 7, NULL, 1, 1, 4294967295, 4294966295, 1), (NULL, 27, 7, NULL, 1, 1, 4294967295, 4294966295, 1), (NULL, 28, 7, NULL, 1, 1, 4294967295, 4294966295, 1)