Skip to content

Instantly share code, notes, and snippets.

@ericrisler
Last active August 31, 2021 13:52
Show Gist options
  • Select an option

  • Save ericrisler/674d9929101a3f9ecdca8fadf47e1cf3 to your computer and use it in GitHub Desktop.

Select an option

Save ericrisler/674d9929101a3f9ecdca8fadf47e1cf3 to your computer and use it in GitHub Desktop.

Revisions

  1. ericrisler revised this gist Feb 22, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions magento2_essentials.md
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,9 @@ http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/bk-javascript-dev-gu
    Magento2 Import Columns:
    https://firebearstudio.com/blog/the-complete-guide-to-magento-2-product-import-export.html

    Full Pacge Cache and Varnish in Magento2:
    https://inviqa.com/blog/how-full-page-cache-works-magento-2

    CLI Administration
    ------------------

  2. ericrisler renamed this gist Dec 21, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. ericrisler revised this gist Dec 9, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -29,6 +29,9 @@ http://learn.jquery.com/jquery-ui/widget-factory/
    Magento Javascript Devloper Guide:
    http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/bk-javascript-dev-guide.html

    Magento2 Import Columns:
    https://firebearstudio.com/blog/the-complete-guide-to-magento-2-product-import-export.html

    CLI Administration
    ------------------

  4. ericrisler revised this gist Nov 25, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,8 @@ Phrase class and __() in M2: https://gist.github.com/antonmakarenko/7538216

    Magento 2 Product Attributes: http://docs.magento.com/m2/ce/user_guide/stores/attributes-product.html

    Multiple Websites, Stores and Store Views: http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_over.html

    Javascript - jQueryUI Widget Factory:
    http://learn.jquery.com/jquery-ui/widget-factory/

  5. ericrisler revised this gist Oct 27, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -281,4 +281,9 @@ DELIMITER ;
    call drop_all_tables();
    DROP PROCEDURE IF EXISTS `drop_all_tables`;
    ```
    ```

    Debugging Tips
    ------------

    1. Adding or Removing a module using composer on your dev server and updating live server you will have to run the module:enable cli command, setup:upgrade and setup:di:compile on the live server to process the changes.
  6. ericrisler revised this gist Oct 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Essential Reading
    Composer and M2:
    http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/composer-integration.html

    Dependency Injection:
    Dependency Injection (and di.xml details):
    http://devdocs.magento.com/guides/v2.1/extension-dev-guide/depend-inj.html

    Object Manager:
  7. ericrisler revised this gist Oct 27, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,9 @@ Essential Reading
    Composer and M2:
    http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/composer-integration.html

    Dependency Injection:
    http://devdocs.magento.com/guides/v2.1/extension-dev-guide/depend-inj.html

    Object Manager:
    http://alanstorm.com/magento_2_object_manager
    http://alanstorm.com/magento_2_object_manager_instance_objects
  8. ericrisler revised this gist Oct 26, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -214,7 +214,7 @@ TRUNCATE TABLE `report_viewed_product_aggregated_monthly`;
    TRUNCATE TABLE `report_viewed_product_aggregated_yearly`;
    TRUNCATE TABLE `report_viewed_product_index`;
    -- remove related rewrites
    DELETE FROM `url_rewite` WHERE `entity_type`='product';
    DELETE FROM `url_rewrite` WHERE `entity_type`='product';
    -- categories
    -- we don't want to remove and "Root" or "Default" category data.
    @@ -233,7 +233,7 @@ DELETE FROM `catalog_category_entity_varchar` WHERE entity_id NOT IN (1,2);
    TRUNCATE TABLE `catalog_category_product`;
    TRUNCATE TABLE `catalog_category_product_index`;
    -- remove related rewrites
    DELETE FROM `url_rewite` WHERE `entity_type`='category';
    DELETE FROM `url_rewrite` WHERE `entity_type`='category';
    SET FOREIGN_KEY_CHECKS = 1;
  9. ericrisler revised this gist Oct 26, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -126,7 +126,7 @@ TRUNCATE TABLE `review_entity_summary`;
    TRUNCATE TABLE `review_store`;
    -- products
    --TRUNCATE TABLE `cataloginventory_stock`;
    -- TRUNCATE TABLE `cataloginventory_stock`;
    TRUNCATE TABLE `cataloginventory_stock_item`;
    TRUNCATE TABLE `cataloginventory_stock_status`;
    TRUNCATE TABLE `cataloginventory_stock_status_idx`;
  10. ericrisler revised this gist Oct 26, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -213,6 +213,8 @@ TRUNCATE TABLE `report_viewed_product_aggregated_daily`;
    TRUNCATE TABLE `report_viewed_product_aggregated_monthly`;
    TRUNCATE TABLE `report_viewed_product_aggregated_yearly`;
    TRUNCATE TABLE `report_viewed_product_index`;
    -- remove related rewrites
    DELETE FROM `url_rewite` WHERE `entity_type`='product';
    -- categories
    -- we don't want to remove and "Root" or "Default" category data.
    @@ -230,6 +232,8 @@ DELETE FROM `catalog_category_entity_text` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_varchar` WHERE entity_id NOT IN (1,2);
    TRUNCATE TABLE `catalog_category_product`;
    TRUNCATE TABLE `catalog_category_product_index`;
    -- remove related rewrites
    DELETE FROM `url_rewite` WHERE `entity_type`='category';
    SET FOREIGN_KEY_CHECKS = 1;
  11. ericrisler revised this gist Oct 24, 2016. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,11 @@ Phrase class and __() in M2: https://gist.github.com/antonmakarenko/7538216

    Magento 2 Product Attributes: http://docs.magento.com/m2/ce/user_guide/stores/attributes-product.html

    Javascript - jQueryUI Widget Factory:
    http://learn.jquery.com/jquery-ui/widget-factory/

    Magento Javascript Devloper Guide:
    http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/bk-javascript-dev-guide.html

    CLI Administration
    ------------------
  12. ericrisler revised this gist Sep 27, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -230,8 +230,8 @@ TRUNCATE TABLE `catalog_category_product_index`;
    SET FOREIGN_KEY_CHECKS = 1;
    ```

    SQL to drop all tables
    ----------------------
    SQL to drop all tables
    ------------
    credit: http://stackoverflow.com/questions/3476765/mysql-drop-all-tables-ignoring-foreign-keys
    ```
    DELIMITER $$
  13. ericrisler revised this gist Sep 27, 2016. 1 changed file with 41 additions and 0 deletions.
    41 changes: 41 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -228,4 +228,45 @@ TRUNCATE TABLE `catalog_category_product_index`;
    SET FOREIGN_KEY_CHECKS = 1;
    ```

    SQL to drop all tables
    ----------------------
    credit: http://stackoverflow.com/questions/3476765/mysql-drop-all-tables-ignoring-foreign-keys
    ```
    DELIMITER $$
    CREATE PROCEDURE `drop_all_tables`()
    BEGIN
    DECLARE _done INT DEFAULT FALSE;
    DECLARE _tableName VARCHAR(255);
    DECLARE _cursor CURSOR FOR
    SELECT table_name
    FROM information_schema.TABLES
    WHERE table_schema = SCHEMA();
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = TRUE;
    SET FOREIGN_KEY_CHECKS = 0;
    OPEN _cursor;
    REPEAT FETCH _cursor INTO _tableName;
    IF NOT _done THEN
    SET @stmt_sql = CONCAT('DROP TABLE ', _tableName);
    PREPARE stmt1 FROM @stmt_sql;
    EXECUTE stmt1;
    DEALLOCATE PREPARE stmt1;
    END IF;
    UNTIL _done END REPEAT;
    CLOSE _cursor;
    SET FOREIGN_KEY_CHECKS = 1;
    END$$
    DELIMITER ;
    call drop_all_tables();
    DROP PROCEDURE IF EXISTS `drop_all_tables`;
    ```
  14. ericrisler revised this gist Aug 22, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,8 @@ http://alanstorm.com/magento-2-frontend-files-serving

    Phrase class and __() in M2: https://gist.github.com/antonmakarenko/7538216

    Magento 2 Product Attributes: http://docs.magento.com/m2/ce/user_guide/stores/attributes-product.html


    CLI Administration
    ------------------
  15. ericrisler revised this gist Aug 20, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,8 @@ http://inchoo.net/magento-2/setup-scripts-magento-2/
    Serving frontend content, production vs development "modes", adding js to a site, etc:
    http://alanstorm.com/magento-2-frontend-files-serving

    Phrase class and __() in M2: https://gist.github.com/antonmakarenko/7538216


    CLI Administration
    ------------------
  16. ericrisler revised this gist Aug 20, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ http://alanstorm.com/magento_2_object_manager_instance_objects
    Install & Upgrade Script:
    http://inchoo.net/magento-2/setup-scripts-magento-2/

    Serving frontend content and "modes":
    Serving frontend content, production vs development "modes", adding js to a site, etc:
    http://alanstorm.com/magento-2-frontend-files-serving


  17. ericrisler revised this gist Aug 20, 2016. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,12 @@ Object Manager:
    http://alanstorm.com/magento_2_object_manager
    http://alanstorm.com/magento_2_object_manager_instance_objects

    Install & Upgrade Script
    Install & Upgrade Script:
    http://inchoo.net/magento-2/setup-scripts-magento-2/

    Serving frontend content and "modes":
    http://alanstorm.com/magento-2-frontend-files-serving


    CLI Administration
    ------------------
  18. ericrisler revised this gist Aug 20, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,9 @@ Object Manager:
    http://alanstorm.com/magento_2_object_manager
    http://alanstorm.com/magento_2_object_manager_instance_objects

    Install & Upgrade Script
    http://inchoo.net/magento-2/setup-scripts-magento-2/


    CLI Administration
    ------------------
  19. ericrisler revised this gist Aug 19, 2016. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,8 @@
    Essential Reading:
    Essential Reading
    ------------

    Composer and M2:
    http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/composer-integration.html

    Object Manager:
    http://alanstorm.com/magento_2_object_manager
  20. ericrisler revised this gist Aug 19, 2016. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -22,8 +22,10 @@ Compile all auto-generated classes:
    ```php bin/magento setup:di:compile```


    SQL to clear products, customers, categories, etc
    -------------------------------------------------
    SQL to clear products, customers, categories, etc
    ------------------


    ```
    -- Magento2
    -- Clear product, orders, customers, reviews, etc.
  21. ericrisler renamed this gist Aug 19, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt → Magento2_Essentials.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ CLI Administration

    Update your env.php with new credentials:

    ```php bin/magento setup:config:set --db-host="host" --db-name="database_name" --db-user="user" --db-password="pass"```
    `php bin/magento setup:config:set --db-host="host" --db-name="database_name" --db-user="user" --db-password="pass"`

    Change the base url:

    @@ -25,7 +25,7 @@ Compile all auto-generated classes:
    SQL to clear products, customers, categories, etc
    -------------------------------------------------
    ```
    -- Magento2
    -- Magento2
    -- Clear product, orders, customers, reviews, etc.
    SET FOREIGN_KEY_CHECKS = 0;
  22. ericrisler revised this gist Aug 19, 2016. 1 changed file with 196 additions and 4 deletions.
    200 changes: 196 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -10,14 +10,206 @@ CLI Administration

    Update your env.php with new credentials:

    `php bin/magento setup:config:set --db-host="host" --db-name="database_name" --db-user="user" --db-password="pass"`
    ```php bin/magento setup:config:set --db-host="host" --db-name="database_name" --db-user="user" --db-password="pass"```

    Change the base url:

    `php bin/magento setup:store-config:set --base-url="http://someurl" --base-url-secure="https://somesecureurl"`
    ```php bin/magento setup:store-config:set --base-url="http://someurl" --base-url-secure="https://somesecureurl"```

    Compile all auto-generated classes:
    This happens automatically on page load but you really should do this manually.

    `php bin/magento setup:di:compile`

    ```php bin/magento setup:di:compile```


    SQL to clear products, customers, categories, etc
    -------------------------------------------------
    ```
    -- Magento2
    -- Clear product, orders, customers, reviews, etc.
    SET FOREIGN_KEY_CHECKS = 0;

    -- orders
    TRUNCATE TABLE `gift_message`;
    TRUNCATE TABLE `quote`;
    TRUNCATE TABLE `quote_address`;
    TRUNCATE TABLE `quote_address_item`;
    TRUNCATE TABLE `quote_id_mask`;
    TRUNCATE TABLE `quote_item`;
    TRUNCATE TABLE `quote_item_option`;
    TRUNCATE TABLE `quote_payment`;
    TRUNCATE TABLE `quote_shipping_rate`;
    TRUNCATE TABLE `reporting_orders`;
    TRUNCATE TABLE `sales_bestsellers_aggregated_daily`;
    TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`;
    TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`;
    TRUNCATE TABLE `sales_creditmemo`;
    TRUNCATE TABLE `sales_creditmemo_comment`;
    TRUNCATE TABLE `sales_creditmemo_grid`;
    TRUNCATE TABLE `sales_creditmemo_item`;
    TRUNCATE TABLE `sales_invoice`;
    TRUNCATE TABLE `sales_invoiced_aggregated`;
    TRUNCATE TABLE `sales_invoiced_aggregated_order`;
    TRUNCATE TABLE `sales_invoice_comment`;
    TRUNCATE TABLE `sales_invoice_grid`;
    TRUNCATE TABLE `sales_invoice_item`;
    TRUNCATE TABLE `sales_order`;
    TRUNCATE TABLE `sales_order_address`;
    TRUNCATE TABLE `sales_order_aggregated_created`;
    TRUNCATE TABLE `sales_order_aggregated_updated`;
    TRUNCATE TABLE `sales_order_grid`;
    TRUNCATE TABLE `sales_order_item`;
    TRUNCATE TABLE `sales_order_payment`;
    TRUNCATE TABLE `sales_order_status_history`;
    TRUNCATE TABLE `sales_order_tax`;
    TRUNCATE TABLE `sales_order_tax_item`;
    TRUNCATE TABLE `sales_payment_transaction`;
    TRUNCATE TABLE `sales_refunded_aggregated`;
    TRUNCATE TABLE `sales_refunded_aggregated_order`;
    TRUNCATE TABLE `sales_shipment`;
    TRUNCATE TABLE `sales_shipment_comment`;
    TRUNCATE TABLE `sales_shipment_grid`;
    TRUNCATE TABLE `sales_shipment_item`;
    TRUNCATE TABLE `sales_shipment_track`;
    TRUNCATE TABLE `sales_shipping_aggregated`;
    TRUNCATE TABLE `sales_shipping_aggregated_order`;
    TRUNCATE TABLE `tax_order_aggregated_created`;
    TRUNCATE TABLE `tax_order_aggregated_updated`;

    -- customers
    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`;
    TRUNCATE TABLE `customer_entity_decimal`;
    TRUNCATE TABLE `customer_entity_int`;
    TRUNCATE TABLE `customer_entity_text`;
    TRUNCATE TABLE `customer_entity_varchar`;
    TRUNCATE TABLE `customer_grid_flat`;
    TRUNCATE TABLE `customer_log`;
    TRUNCATE TABLE `customer_log`;
    TRUNCATE TABLE `customer_visitor`;
    TRUNCATE TABLE `persistent_session`;
    TRUNCATE TABLE `wishlist`;
    TRUNCATE TABLE `wishlist_item`;
    TRUNCATE TABLE `wishlist_item_option`;

    -- review
    TRUNCATE TABLE `review`;
    TRUNCATE TABLE `review_detail`;
    TRUNCATE TABLE `review_entity_summary`;
    TRUNCATE TABLE `review_store`;

    -- products
    --TRUNCATE TABLE `cataloginventory_stock`;
    TRUNCATE TABLE `cataloginventory_stock_item`;
    TRUNCATE TABLE `cataloginventory_stock_status`;
    TRUNCATE TABLE `cataloginventory_stock_status_idx`;
    TRUNCATE TABLE `cataloginventory_stock_status_tmp`;
    TRUNCATE TABLE `catalog_category_product`;
    TRUNCATE TABLE `catalog_category_product_index`;
    TRUNCATE TABLE `catalog_category_product_index_tmp`;
    TRUNCATE TABLE `catalog_compare_item`;
    TRUNCATE TABLE `catalog_product_bundle_option`;
    TRUNCATE TABLE `catalog_product_bundle_option_value`;
    TRUNCATE TABLE `catalog_product_bundle_price_index`;
    TRUNCATE TABLE `catalog_product_bundle_selection`;
    TRUNCATE TABLE `catalog_product_bundle_selection_price`;
    TRUNCATE TABLE `catalog_product_bundle_stock_index`;
    TRUNCATE TABLE `catalog_product_entity`;
    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`;
    TRUNCATE TABLE `catalog_product_entity_media_gallery_value_to_entity`;
    TRUNCATE TABLE `catalog_product_entity_media_gallery_value_video`;
    TRUNCATE TABLE `catalog_product_entity_text`;
    TRUNCATE TABLE `catalog_product_entity_tier_price`;
    TRUNCATE TABLE `catalog_product_entity_varchar`;
    TRUNCATE TABLE `catalog_product_index_eav`;
    TRUNCATE TABLE `catalog_product_index_eav_decimal`;
    TRUNCATE TABLE `catalog_product_index_eav_decimal_idx`;
    TRUNCATE TABLE `catalog_product_index_eav_decimal_tmp`;
    TRUNCATE TABLE `catalog_product_index_eav_idx`;
    TRUNCATE TABLE `catalog_product_index_eav_tmp`;
    TRUNCATE TABLE `catalog_product_index_price`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_idx`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_opt_idx`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_opt_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_sel_idx`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_sel_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_bundle_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_cfg_opt_agr_idx`;
    TRUNCATE TABLE `catalog_product_index_price_cfg_opt_agr_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_cfg_opt_idx`;
    TRUNCATE TABLE `catalog_product_index_price_cfg_opt_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_downlod_idx`;
    TRUNCATE TABLE `catalog_product_index_price_downlod_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_final_idx`;
    TRUNCATE TABLE `catalog_product_index_price_final_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_idx`;
    TRUNCATE TABLE `catalog_product_index_price_opt_agr_idx`;
    TRUNCATE TABLE `catalog_product_index_price_opt_agr_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_opt_idx`;
    TRUNCATE TABLE `catalog_product_index_price_opt_tmp`;
    TRUNCATE TABLE `catalog_product_index_price_tmp`;
    TRUNCATE TABLE `catalog_product_index_tier_price`;
    TRUNCATE TABLE `catalog_product_index_website`;
    TRUNCATE TABLE `catalog_product_link`;
    TRUNCATE TABLE `catalog_product_link_attribute`;
    TRUNCATE TABLE `catalog_product_link_attribute_decimal`;
    TRUNCATE TABLE `catalog_product_link_attribute_int`;
    TRUNCATE TABLE `catalog_product_link_attribute_varchar`;
    TRUNCATE TABLE `catalog_product_option`;
    TRUNCATE TABLE `catalog_product_option_price`;
    TRUNCATE TABLE `catalog_product_option_title`;
    TRUNCATE TABLE `catalog_product_option_type_price`;
    TRUNCATE TABLE `catalog_product_option_type_title`;
    TRUNCATE TABLE `catalog_product_option_type_value`;
    TRUNCATE TABLE `catalog_product_relation`;
    TRUNCATE TABLE `catalog_product_super_attribute`;
    TRUNCATE TABLE `catalog_product_super_attribute_label`;
    TRUNCATE TABLE `catalog_product_super_link`;
    TRUNCATE TABLE `catalog_product_website`;
    TRUNCATE TABLE `catalog_url_rewrite_product_category`;
    TRUNCATE TABLE `downloadable_link`;
    TRUNCATE TABLE `downloadable_link_price`;
    TRUNCATE TABLE `downloadable_link_purchased`;
    TRUNCATE TABLE `downloadable_link_purchased_item`;
    TRUNCATE TABLE `downloadable_link_title`;
    TRUNCATE TABLE `downloadable_sample`;
    TRUNCATE TABLE `downloadable_sample_title`;
    TRUNCATE TABLE `product_alert_price`;
    TRUNCATE TABLE `product_alert_stock`;
    TRUNCATE TABLE `report_compared_product_index`;
    TRUNCATE TABLE `report_viewed_product_aggregated_daily`;
    TRUNCATE TABLE `report_viewed_product_aggregated_monthly`;
    TRUNCATE TABLE `report_viewed_product_aggregated_yearly`;
    TRUNCATE TABLE `report_viewed_product_index`;

    -- categories
    -- we don't want to remove and "Root" or "Default" category data.
    -- TRUNCATE TABLE `catalog_category_entity`;
    -- TRUNCATE TABLE `catalog_category_entity_datetime`;
    -- TRUNCATE TABLE `catalog_category_entity_decimal`;
    -- TRUNCATE TABLE `catalog_category_entity_int`;
    -- TRUNCATE TABLE `catalog_category_entity_text`;
    -- TRUNCATE TABLE `catalog_category_entity_varchar`;
    DELETE FROM `catalog_category_entity` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_datetime` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_decimal` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_int` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_text` WHERE entity_id NOT IN (1,2);
    DELETE FROM `catalog_category_entity_varchar` WHERE entity_id NOT IN (1,2);
    TRUNCATE TABLE `catalog_category_product`;
    TRUNCATE TABLE `catalog_category_product_index`;


    SET FOREIGN_KEY_CHECKS = 1;
    ```
  23. ericrisler revised this gist Aug 17, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,11 +5,12 @@ http://alanstorm.com/magento_2_object_manager
    http://alanstorm.com/magento_2_object_manager_instance_objects


    CLI Administration:
    CLI Administration
    ------------------

    Update your env.php with new credentials:

    `php bin/magento setup:config:set `
    `php bin/magento setup:config:set --db-host="host" --db-name="database_name" --db-user="user" --db-password="pass"`

    Change the base url:

  24. ericrisler created this gist Aug 17, 2016.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    Essential Reading:

    Object Manager:
    http://alanstorm.com/magento_2_object_manager
    http://alanstorm.com/magento_2_object_manager_instance_objects


    CLI Administration:

    Update your env.php with new credentials:

    `php bin/magento setup:config:set `

    Change the base url:

    `php bin/magento setup:store-config:set --base-url="http://someurl" --base-url-secure="https://somesecureurl"`

    Compile all auto-generated classes:
    This happens automatically on page load but you really should do this manually.

    `php bin/magento setup:di:compile`