Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename mysql4 sql files #1619

Closed
wants to merge 1 commit into from
Closed

Rename mysql4 sql files #1619

wants to merge 1 commit into from

Conversation

luigifab
Copy link
Contributor

@luigifab luigifab commented May 16, 2021

Description

This (useless) PR rename ~95% of sql/mysql4-* files (620 files renamed without changes).
Script used to rename files:

$files = [];
exec('find app/ -name "mysql4-*.php"', $files);

foreach ($files as $file) {
	echo $file,"\n";
	$newfile = str_replace('mysql4-', '', $file);
	if ((stripos($newfile, 'data-upgrade') === false) && !is_file($newfile)) {
		if (stripos(file_get_contents($file), '$installFile') === false)
			rename($file, $newfile);
	}
}

Files not renamed:

fabrice@mario:/var/www/magento-lts$ php a.php 
app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php
app/code/core/Mage/Bundle/sql/bundle_setup/mysql4-data-upgrade-0.1.13-0.1.14.php
app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php
app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-data-upgrade-0.7.57-0.7.58.php
app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-data-upgrade-0.7.63-0.7.64.php
app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-data-upgrade-1.4.0.0.28-1.4.0.0.29.php
app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-data-upgrade-1.4.0.0.42-1.4.0.0.43.php
app/code/core/Mage/Core/sql/core_setup/mysql4-data-upgrade-1.6.0.2-1.6.0.3.php
app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.11-1.4.0.0.12.php
app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.13-1.4.0.0.14.php
app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.7-1.4.0.0.8.php
app/code/core/Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.8-1.4.0.0.9.php
app/code/core/Mage/Directory/sql/directory_setup/mysql4-upgrade-1.6.0.1-1.6.0.2.php
app/code/core/Mage/Paygate/sql/paygate_setup/mysql4-data-upgrade-0.7.0-0.7.1.php
app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-1.5.0.0.php
app/code/core/Mage/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php
app/code/core/Mage/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php

If I rename mysql4-data-upgrade, two files are not executed. I not checked why.

Manual testing scenarios

  • Create two empty databases: before and after.
  • Update your local.xml to use before database.
  • Clear var/ directory and go to home page with your browser.
  • Wait during database regeneration...
  • Apply PR (or run php snippet)
  • Update your local.xml to use after database.
  • Clear var/ directory and go to home page with your browser.
  • Wait during database regeneration...
  • Run: mysqldump --skip-comments --skip-extended-insert -u root -p before > file1.sql
  • Run: mysqldump --skip-comments --skip-extended-insert -u root -p after > file2.sql
  • Run: diff -I "20[0-9][0-9]-" file1.sql file2.sql
  • Result: no differences

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added Component: AdminNotification Relates to Mage_AdminNotification Component: Admin Relates to Mage_Admin Component: Api PageRelates to Mage_Api Component: Bundle Relates to Mage_Bundle Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: CatalogRule Relates to Mage_CatalogRule Component: CatalogIndex Relates to Mage_CatalogIndex Component: CatalogSearch Relates to Mage_CatalogSearch Component: Checkout Relates to Mage_Checkout Component: Cms Relates to Mage_Cms Component: Contacts Relates to Mage_Contacts Component: Core Relates to Mage_Core Component: Cron Relates to Mage_Cron Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Directory Relates to Mage_Directory Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Log Relates to Mage_Log Component: Paygate Relates to Mage_Paygate Component: PayPal Relates to Mage_Paypal Component: PaypalUk Relates to Mage_PaypalUk Component: Poll Relates to Mage_Poll Component: ProductAlert Relates to Mage_ProductAlert Component: Rating Relates to Mage_Rating Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review labels May 16, 2021
@github-actions github-actions bot added Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Sendfriend Relates to Mage_Sendfriend Component: Shipping Relates to Mage_Shipping Component: Sitemap Relates to Mage_Sitemap Component: Tag Relates to Mage_Tag Component: Tax Relates to Mage_Tax Component: Usa Relates to Mage_Usa Component: Weee Relates to Mage_Weee Component: Widget Relates to Mage_Widget Component: Wishlist Relates to Mage_Wishlist labels May 16, 2021
@kkrieger85
Copy link
Contributor

At first a big thank you for this super nice description of the PR and how to easily check this huge PR.

Thank you for these "step by step". It makes reviewing this PR much easier.

@luigifab
Copy link
Contributor Author

luigifab commented Jul 23, 2021

I downloaded Magento 1.4.1.1. I created an empty database, updated the local.xml, cleared var/ directory and go to home page with my browser to regenerate database.

(I also removed ROW_FORMAT=FIXED in sql files, I also installed php5-6 from deb.sury.org)

Then I...

  • Create two databases: before and after.
  • Import the Magento 1.4 database into before and after.
  • Update your local.xml to use before database.
  • Clear var/ directory and go to home page with your browser.
  • Wait during database regeneration...
  • Apply PR
  • Update your local.xml to use after database.
  • Clear var/ directory and go to home page with your browser.
  • Wait during database regeneration...
  • Run: mysqldump --skip-comments --skip-extended-insert -u root -p before > file1.sql
  • Run: mysqldump --skip-comments --skip-extended-insert -u root -p after > file2.sql
  • Run: diff -I "20[0-9][0-9]-" file1.sql file2.sql
  • Result: no differences

@luigifab luigifab marked this pull request as ready for review July 23, 2021 13:43
@luigifab
Copy link
Contributor Author

Without -I:

fabrice@mario:/var/www$ diff before.sql  after.sql 
159,160c159,160
< INSERT INTO `api2_acl_role` VALUES (1,'2021-07-23 13:36:44',NULL,'Guest');
< INSERT INTO `api2_acl_role` VALUES (2,'2021-07-23 13:36:44',NULL,'Customer');
---
> INSERT INTO `api2_acl_role` VALUES (1,'2021-07-23 13:39:07',NULL,'Guest');
> INSERT INTO `api2_acl_role` VALUES (2,'2021-07-23 13:39:07',NULL,'Customer');
2749,2750c2749,2750
< INSERT INTO `cms_block` VALUES (5,'Footer Links','footer_links','<ul>\r\n<li><a href=\"{{store direct_url=\"about-magento-demo-store\"}}\">About Us</a></li>\r\n<li><a href=\"{{store direct_url=\"customer-service\"}}\">Customer Service</a></li>\r\n<li class=\"last privacy\"><a href=\"{{store direct_url=\"privacy-policy-cookie-restriction-mode\"}}\">Privacy Policy</a></li>\r\n</ul>','2021-07-23 13:28:18','2021-07-23 11:36:47',1);
< INSERT INTO `cms_block` VALUES (6,'Cookie restriction notice','cookie_restriction_notice_block','<p>This website requires cookies to provide all of its features. For more information on what data is contained in the cookies, please see our <a href=\"{{store direct_url=\"privacy-policy-cookie-restriction-mode\"}}\">Privacy Policy page</a>. To accept cookies from this site, please click the Allow button below.</p>','2021-07-23 11:36:47','2021-07-23 11:36:47',1);
---
> INSERT INTO `cms_block` VALUES (5,'Footer Links','footer_links','<ul>\r\n<li><a href=\"{{store direct_url=\"about-magento-demo-store\"}}\">About Us</a></li>\r\n<li><a href=\"{{store direct_url=\"customer-service\"}}\">Customer Service</a></li>\r\n<li class=\"last privacy\"><a href=\"{{store direct_url=\"privacy-policy-cookie-restriction-mode\"}}\">Privacy Policy</a></li>\r\n</ul>','2021-07-23 13:28:18','2021-07-23 11:39:09',1);
> INSERT INTO `cms_block` VALUES (6,'Cookie restriction notice','cookie_restriction_notice_block','<p>This website requires cookies to provide all of its features. For more information on what data is contained in the cookies, please see our <a href=\"{{store direct_url=\"privacy-policy-cookie-restriction-mode\"}}\">Privacy Policy page</a>. To accept cookies from this site, please click the Allow button below.</p>','2021-07-23 11:39:09','2021-07-23 11:39:09',1);
2806c2806
< INSERT INTO `cms_page` VALUES (6,'Privacy Policy','one_column',NULL,NULL,'privacy-policy-cookie-restriction-mode','Privacy Policy','<p style=\"color: #ff0000; ....le>','2021-07-23 11:36:47','2021-07-23 11:36:47',1,0,NULL,NULL,NULL,NULL,NULL,NULL);
---
> INSERT INTO `cms_page` VALUES (6,'Privacy Policy','one_column',NULL,NULL,'privacy-policy-cookie-restriction-mode','Privacy Policy','<p style=\"color: #ff0000; ....le>','2021-07-23 11:39:09','2021-07-23 11:39:09',1,0,NULL,NULL,NULL,NULL,NULL,NULL);
2896,2900c2896,2900
< INSERT INTO `core_config_data` VALUES (1,'default',0,'catalog/category/root_id','2','2021-07-23 13:34:50');
< INSERT INTO `core_config_data` VALUES (2,'default',0,'advanced/modules_disable_output/Mage_Backup','1','2021-07-23 13:34:50');
< INSERT INTO `core_config_data` VALUES (3,'default',0,'general/region/display_all','1','2021-07-23 13:36:45');
< INSERT INTO `core_config_data` VALUES (4,'default',0,'general/region/state_required','AT,CA,CH,DE,EE,ES,FI,FR,LT,LV,RO,US','2021-07-23 13:36:45');
< INSERT INTO `core_config_data` VALUES (5,'default',0,'payment/paypal_express/skip_order_review_step','0','2021-07-23 13:36:47');
---
> INSERT INTO `core_config_data` VALUES (1,'default',0,'catalog/category/root_id','2','2021-07-23 13:37:18');
> INSERT INTO `core_config_data` VALUES (2,'default',0,'advanced/modules_disable_output/Mage_Backup','1','2021-07-23 13:37:18');
> INSERT INTO `core_config_data` VALUES (3,'default',0,'general/region/display_all','1','2021-07-23 13:39:08');
> INSERT INTO `core_config_data` VALUES (4,'default',0,'general/region/state_required','AT,CA,CH,DE,EE,ES,FI,FR,LT,LV,RO,US','2021-07-23 13:39:08');
> INSERT INTO `core_config_data` VALUES (5,'default',0,'payment/paypal_express/skip_order_review_step','0','2021-07-23 13:39:09');
6606c6606
< INSERT INTO `log_visitor` VALUES (2,'bqll2cb1vj42sjjihpg8sfkdsm','2021-07-23 11:36:47','2021-07-23 11:36:47',0,1);
---
> INSERT INTO `log_visitor` VALUES (2,'bqll2cb1vj42sjjihpg8sfkdsm','2021-07-23 11:39:09','2021-07-23 11:39:09',0,1);
6783c6783
< INSERT INTO `newsletter_template` VALUES (1,'Example Newsletter Template','{{temp....email/footer\"}}',NULL,NULL,2,'Example Subject','Owner','[email protected]',1,'2021-07-23 11:36:47','2021-07-23 11:36:47');
---
> INSERT INTO `newsletter_template` VALUES (1,'Example Newsletter Template','{{temp....email/footer\"}}',NULL,NULL,2,'Example Subject','Owner','[email protected]',1,'2021-07-23 11:39:09','2021-07-23 11:39:09');

@fballiano
Copy link
Contributor

fballiano commented May 30, 2022

so, excluding some datetime differences the database seems exactly the same no?

what benefit do we have from this massive rename?

@luigifab
Copy link
Contributor Author

luigifab commented Jun 6, 2022

Yes, for me, no differences in database.
Benefit? 620x7 characters saved!

fballiano
fballiano previously approved these changes Jun 6, 2022
tmewes
tmewes previously approved these changes Jun 6, 2022
kiatng
kiatng previously approved these changes Jun 6, 2022
@fballiano
Copy link
Contributor

conflict impeding merge

@luigifab luigifab dismissed stale reviews from kiatng, tmewes, and fballiano via e7518e1 July 14, 2022 20:31
@luigifab
Copy link
Contributor Author

Rebase without conflict.

@sreichel
Copy link
Contributor

sreichel commented Dec 2, 2022

This (useless) PR rename ~95%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Relates to Mage_Admin Component: AdminNotification Relates to Mage_AdminNotification Component: Api PageRelates to Mage_Api Component: Bundle Relates to Mage_Bundle Component: Catalog Relates to Mage_Catalog Component: CatalogIndex Relates to Mage_CatalogIndex Component: CatalogInventory Relates to Mage_CatalogInventory Component: CatalogRule Relates to Mage_CatalogRule Component: CatalogSearch Relates to Mage_CatalogSearch Component: Checkout Relates to Mage_Checkout Component: Cms Relates to Mage_Cms Component: Contacts Relates to Mage_Contacts Component: Core Relates to Mage_Core Component: Cron Relates to Mage_Cron Component: Customer Relates to Mage_Customer Component: Dataflow Relates to Mage_Dataflow Component: Directory Relates to Mage_Directory Component: Downloadable Relates to Mage_Downloadable Component: Eav Relates to Mage_Eav Component: ImportExport Relates to Mage_ImportExport Component: Index Relates to Mage_Index Component: Log Relates to Mage_Log Component: Paygate Relates to Mage_Paygate Component: PayPal Relates to Mage_Paypal Component: PaypalUk Relates to Mage_PaypalUk Component: Poll Relates to Mage_Poll Component: ProductAlert Relates to Mage_ProductAlert Component: Rating Relates to Mage_Rating Component: Reports Relates to Mage_Reports Component: Review Relates to Mage_Review Component: Sales Relates to Mage_Sales Component: SalesRule Relates to Mage_SalesRule Component: Sendfriend Relates to Mage_Sendfriend Component: Shipping Relates to Mage_Shipping Component: Sitemap Relates to Mage_Sitemap Component: Tag Relates to Mage_Tag Component: Tax Relates to Mage_Tax Component: Usa Relates to Mage_Usa Component: Weee Relates to Mage_Weee Component: Widget Relates to Mage_Widget Component: Wishlist Relates to Mage_Wishlist Don't forget this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants