You are here

function page_title_update_1 in Page Title 5

Same name and namespace in other branches
  1. 5.2 page_title.install \page_title_update_1()

Increases page title in MySQL to 255 characters and modifies the MySQL table type from MYISAM to the user's default type.

Implementation of hook_update_N().

File

./page_title.install, line 48

Code

function page_title_update_1() {
  $items = array();
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $items[] = update_sql('ALTER TABLE {page_title} MODIFY COLUMN page_title VARCHAR(255) NOT NULL');
      $items[] = update_sql('CREATE TEMPORARY TABLE {page_title_temp} AS SELECT * FROM {page_title}');
      $items[] = update_sql('DROP TABLE {page_title}');
      $items[] = update_sql('CREATE TABLE {page_title} (
                               nid INT NOT NULL,
                               page_title VARCHAR(255) NOT NULL,
                               PRIMARY KEY (nid)
                             ) /*!40100 DEFAULT CHARACTER SET utf8 */;');
      $items[] = update_sql('INSERT INTO {page_title} (nid, page_title)
                               SELECT nid, page_title FROM {page_title_temp}');
      $items[] = update_sql('DROP TABLE {page_title_temp}');
  }
  return $items;
}