Skip to content

Instantly share code, notes, and snippets.

Avatar

Sudhanshu Bajaj sudhanshu-bajaj

View GitHub Profile
@sudhanshu-bajaj
sudhanshu-bajaj / backup-cli.sh
Last active Apr 4, 2021
Magento 2 : How to Backup Db, Media, Code command line
View backup-cli.sh
#If the Magento backup functionality does not start or displays the following message, you need to enable the feature prior to backing up.
# - Backup functionality is disabled.
# - Backup functionality is currently disabled. Please use other means for backups.
$ php bin/magento config:set system/backup/functionality_enabled 1
$ php bin/magento setup:backup --code
#Enabling maintenance mode
#Code backup is starting...
#Code backup filename: 1617533283_filesystem_code.tgz (The archive can be uncompressed with 7-Zip on Windows systems)
#Code backup path: /Users/sudhanshubajaj/Projects/development/m23-ee-latest/var/backups/1617533283_filesystem_code.tgz
#[SUCCESS]: Code backup completed successfully.
@sudhanshu-bajaj
sudhanshu-bajaj / reset-products-and-categories.sql
Last active Apr 3, 2021
Magento 2 : Truncate Products & Categories MySql
View reset-products-and-categories.sql
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
@sudhanshu-bajaj
sudhanshu-bajaj / reset-customer.sql
Created Apr 3, 2021
Magento 2: How to delete all customers data?
View reset-customer.sql
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `amazon_customer`;
TRUNCATE TABLE `customer_address_entity`;
TRUNCATE TABLE `customer_address_entity_datetime`;
TRUNCATE TABLE `customer_address_entity_decimal`;
TRUNCATE TABLE `customer_address_entity_int`;
TRUNCATE TABLE `customer_address_entity_text`;
TRUNCATE TABLE `customer_address_entity_varchar`;
TRUNCATE TABLE `customer_entity`;
TRUNCATE TABLE `customer_entity_datetime`;