Add "modifyExtensionField" utility function
authorReedy <reedy@wikimedia.org>
Sun, 6 Jan 2013 03:03:36 +0000 (03:03 +0000)
committerReedy <reedy@wikimedia.org>
Sun, 6 Jan 2013 03:03:36 +0000 (03:03 +0000)
As calling $updater->modifyField will do the action immediately (not queued),
this may be undesired.

So this is a shortcut/utility function like addExtensionField/addExtensionTable etc,
instead of the developer calling addExtensionUpdate( array() ) themselves.

Change-Id: Ie94f2b42679062c6e106ae560faab26818a9b15c

includes/installer/DatabaseUpdater.php

index 7357482..ac3f7b6 100644 (file)
@@ -295,6 +295,17 @@ abstract class DatabaseUpdater {
                $this->extensionUpdates[] = array( 'renameIndex', $tableName, $oldIndexName, $newIndexName, $skipBothIndexExistWarning, $sqlPath, true );
        }
 
+       /**
+        * @since 1.21
+        *
+        * @param $tableName string The table name
+        * @param $fieldName string The field to be modified
+        * @param $sqlPath string The path to the SQL change path
+        */
+       public function modifyExtensionField( $tableName, $fieldName, $sqlPath) {
+               $this->extensionUpdates[] = array( 'modifyField', $tableName, $fieldName, $sqlPath, true );
+       }
+
        /**
         *
         * @since 1.20