Page MenuHomeIn-Portal Phabricator

INP-1803 - Show non-executed SQLs during deployment
ClosedPublic

Authored by alex on May 3 2021, 12:09 PM.

Details

Test Plan

Preparations

  1. replace contents of the /modules/custom/install/project_upgrades.sql file with this (replace 52x_ with your table prefix from /system/config.php):
# r1: Initial Project Task (#TASK_ID)
SELECT FirstName FROM `52x_Users`;
# some comment above error
ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 ERROR12 ERROR13 ERROR14 ERROR15 ERROR16 ERROR17 ERROR18 ERROR19 ERROR20 ERROR21;
SELECT LastName FROM `52x_Users`;
# some comment below error
  1. clear contents of /system/.restricted/project_upgrades.log file
  2. execute UPDATE 52x_Modules` SET AppliedDBRevisions = NULL; (replace 52x_` with your table prefix from /system/config.php) database query

Test itself

  1. run the php tools/run_event.php adm:OnDeploy b674006f3edb1d9cd4d838c150b0567d script
  2. confirm, that contents of SQL-related part of deployment script output looks like this:
# r1: Initial Project Task (#TASK_ID)
SELECT FirstName FROM `52x_Users` ... OK (4)
# some comment above error
ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 ERROR12 ERROR13 ERROR14 ERROR15 ERROR16 E ... FAILED
SQL Error #1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 E' at line 1
Execute rest of SQLs in this Revision (show below) by hand and RUN deployment script again to complete the deployment process.
========
ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 ERROR12 ERROR13 ERROR14 ERROR15 ERROR16 ERROR17 ERROR18 ERROR19 ERROR20 ERROR21;
SELECT LastName FROM `52x_Users`;
# some comment below error
========
  1. confirm, that from the above output:
  2. the # some comment above error and # some comment below error are shown in magenta color (as all comments should be)
  3. the SQL Error line is shown in red color (as FAILED text in the line above it)
  4. the Execute rest of SQLs in this Revision (show below) by hand and RUN deployment script again to complete the deployment process. line in shown in bright red color (like bold in CLI)
  5. confirm, that text added into /system/.restricted/project_upgrades.log looks like this (execution start/end date/times would be different, but durations must match):
[2020-12-28 16:39:08] ===  ===

[2021-05-03 19:59:11] ===  ===
SELECT FirstName FROM `52x_Users` ... OK (4)
# some comment above error
ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 ERROR12 ERROR13 ERROR14 ERROR15 ERROR16 ERROR17 ERROR18 ERROR19 ERROR20 ERROR21 ... FAILED
SQL Error #1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 E' at line 1
Execute rest of SQLs in this Revision (show below) by hand and RUN deployment script again to complete the deployment process.
========
ERROR1 ERROR2 ERROR3 ERROR4 ERROR5 ERROR6 ERROR7 ERROR8 ERROR9 ERROR10 ERROR11 ERROR12 ERROR13 ERROR14 ERROR15 ERROR16 ERROR17 ERROR18 ERROR19 ERROR20 ERROR21
SELECT LastName FROM `52x_Users`
# some comment below error
========

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex created this revision.May 3 2021, 12:09 PM
alex requested review of this revision.May 3 2021, 12:09 PM
alex edited the test plan for this revision. (Show Details)May 3 2021, 12:15 PM
alex added a project: Restricted Project.
alex edited the test plan for this revision. (Show Details)
erik accepted this revision.May 7 2021, 2:34 AM
This revision is now accepted and ready to land.May 7 2021, 2:34 AM
This revision was automatically updated to reflect the committed changes.