You are here

function hosting_package_update_6005 in Hostmaster (Aegir) 6

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

modules/hosting/package/hosting_package.install, line 404
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;
}