Child pages
  • [deployment] Duplicate revision detection doesn't look into applied revisions [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

In the  INP-835 - Getting issue details... STATUS  the functionality for automatic deployment of In-Portal based websites to staging and production servers were developed. Several improvements has been made to it since then as well.

One of the key components of deployment process is "project_upgrades.sql" file, that is placed in the "install" sub-folder of a module (e.g. "/modules/in-link/install/project_upgrades.sql"). The file typically looks like this:

# r34: task one
ALTER TABLE aml_OfficeLocations ADD Image VARCHAR(255) NOT NULL DEFAULT '' AFTER Title;
# Image field is required, please add values manually.
 
# r35: another task title
UPDATE aml_LanguageLabels
SET l1_Translation = 'Job Type', l1_ColumnTranslation = 'Job Type'
WHERE PhraseKey = 'LA_FLD_JOBTYPE';

# r35: yet another task title
ALTER TABLE aml_SugarProducts ADD ShortName VARCHAR(255) NOT NULL DEFAULT '' AFTER Name;
DELETE FROM aml_UserPersistentSessionData WHERE VariableName = 'sugar-product[Default]columns_.';

In the above example following can be understood:

  • file consists of several revisions
  • each revision written in special format as MySQL comment
  • each revision has number
  • revision numbers must be unique
  • each revision has SQLs and comments, associated with it

Each deployment server also track status of each revision - deployed or not.

There is also a duplicate revision check, but it only looks through not yet executed revisions. In practice this doesn't help at all, because only last revision is the one, that isn't executed.

Solution

In the "DeploymentHelper::collectDatabaseRevisions" method:

  1. collect all found revisions (regardless of their status) into local "$revision_numbers" array
  2. when new revision is found, then compare it against "$revision_numbers" variable instead of using "$this->revisionSqls" which represents only non-executed revisions

Related Tasks

INP-1564 - Getting issue details... STATUS

1 Comment

  1. Increasing priority, because fixing this would speed up project development.