[REF] simple extraction of getFieldAlterSQL
authoreileen <emcnaughton@wikimedia.org>
Wed, 3 Jul 2019 23:57:59 +0000 (11:57 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 5 Jul 2019 02:37:28 +0000 (14:37 +1200)
CRM/Core/BAO/SchemaHandler.php

index 8d78e337fd7fdbd115ddfd1434a33aaaa6b1226f..c67f3744e88bb7083c8a216e896470c6cf888214 100644 (file)
@@ -759,6 +759,22 @@ MODIFY      {$columnName} varchar( $length )
   public static function buildFieldChangeSql($params, $indexExist) {
     $sql = str_repeat(' ', 8);
     $sql .= "ALTER TABLE {$params['table_name']}";
+    return $sql . self::getFieldAlterSQL($params, $indexExist);
+  }
+
+  /**
+   * Get the sql to alter an individual field.
+   *
+   * This will need to have an ALTER TABLE statement appended but by getting
+   * by individual field we can do one or many.
+   *
+   * @param array $params
+   * @param bool $indexExist
+   *
+   * @return string
+   */
+  public static function getFieldAlterSQL($params, $indexExist) {
+    $sql = '';
     switch ($params['operation']) {
       case 'add':
         $separator = "\n";