Last active
August 29, 2015 14:08
-
-
Save 7ochem/b59f9e71ba0818f38557 to your computer and use it in GitHub Desktop.
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
RESET_SALES_SQL_FILE=reset_sales_tables_$(date +%s).sql && \ | |
( | |
mysqldump --add-drop-table --no-data -K -uroot -p***** DBNAME \ | |
`echo $(mysql -uroot -p***** DBNAME -e "SHOW TABLES LIKE 'sales_flat%';" | tail -n+2)` \ | |
`echo $(mysql -uroot -p***** DBNAME -e "SHOW TABLES LIKE 'sales%aggregated%';" | tail -n+2)` \ | |
| sed 's/ AUTO_INCREMENT=[0-9]*\b//' && \ | |
echo "UPDATE \`eav_entity_store\` SET \`increment_last_id\` = '100000000'" \ | |
"WHERE \`entity_type_id\` IN(SELECT \`entity_type_id\` FROM \`eav_entity_type\` WHERE \`entity_model\` LIKE 'sales/%');" | |
) > $RESET_SALES_SQL_FILE && \ | |
mysql -uroot -p***** DBNAME < $RESET_SALES_SQL_FILE && \ | |
rm $RESET_SALES_SQL_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment