You are here

function hosting_package_update_6005 in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 package/hosting_package.install \hosting_package_update_6005()
  2. 7.3 package/hosting_package.install \hosting_package_update_6005()

Remove DEFAULT value on a LONGTEXT fields and use VARCHAR on smaller fields to optimise queries.

This was breaking in MariaDB and preventing installation. On MySQL it was silently ignored, so the installation works, but the defaults are not in the table anyway.

See #969326 and #934864

File

package/hosting_package.install, line 409
Install, update and uninstall for the package management module.

Code

function hosting_package_update_6005() {
  $ret = array();
  db_change_field($ret, 'hosting_package', 'short_name', 'short_name', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'hosting_package', 'old_short_name', 'old_short_name', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'hosting_package', 'description', 'description', array(
    'type' => 'text',
    'size' => 'big',
    'not null' => TRUE,
  ));
  db_change_field($ret, 'hosting_package_instance', 'filename', 'filename', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_change_field($ret, 'hosting_package_instance', 'version', 'version', array(
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  return $ret;
}