*/
public function upgrade_4_7_26($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
+ $this->addTask('CRM-21234 Missing subdivisions of Tajikistan', 'tajikistanMissingSubdivisions');
$this->addTask('CRM-20892 - Add modified_date to civicrm_mailing', 'addColumn',
'civicrm_mailing', 'modified_date', "timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the mailing (or closely related entity) was created or modified or deleted.'");
$this->addTask('CRM-21195 - Add icon field to civicrm_navigation', 'addColumn',
return TRUE;
}
+ /**
+ * Add in missing Tajikistan Subdivisions
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
+ */
+ public static function tajikistanMissingSubdivisions(CRM_Queue_TaskContext $ctx) {
+ $sql = 'INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES';
+ $updates = array();
+ if (!CRM_Core_DAO::singleValueQuery("Select id FROM civicrm_state_province WHERE country_id = 1209 AND name = 'Dushanbe'")) {
+ $updates[] = '(NULL, 1209, "DU", "Dushanbe")';
+ }
+ if (!CRM_Core_DAO::singleValueQuery("Select id FROM civicrm_state_province WHERE country_id = 1209 AND name = 'Nohiyahoi Tobei Jumhurí'")) {
+ $updates[] = '(NULL, 1209, "RA", "Nohiyahoi Tobei Jumhurí")';
+ }
+ if (!empty($updates)) {
+ CRM_Core_DAO::executeQuery($sql . implode(', ', $updates));
+ }
+ return TRUE;
+ }
+
/**
* Remove the contribution logging reports which have been broken for a very long time.
*
-- CRM-20892 Change created_date default so that we can add a modified_date column
ALTER TABLE civicrm_mailing CHANGE created_date created_date timestamp NULL DEFAULT NULL COMMENT 'Date and time this mailing was created.';
-
--- CRM-21234 Missing subdivisions of Tajikistan.
- INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
- (NULL, 1209, "DU", "Dushanbe"),
- (NULL, 1209, "RA", "Nohiyahoi Tobei Jumhurí");