diff options
Diffstat (limited to 'modules/system/system.install')
-rw-r--r-- | modules/system/system.install | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/system/system.install b/modules/system/system.install index b8561783b..ef59aef5e 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -32,7 +32,8 @@ function system_install() { custom tinyint DEFAULT '0' NOT NULL, throttle tinyint DEFAULT '0' NOT NULL, visibility tinyint DEFAULT '0' NOT NULL, - pages text DEFAULT '' NOT NULL + pages text DEFAULT '' NOT NULL, + title varchar(64) DEFAULT '' NOT NULL ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); db_query("CREATE TABLE {boxes} ( @@ -3047,6 +3048,35 @@ function system_update_1005() { return $ret; } +function system_update_1006() { + // Add a customizable title to all blocks. + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {blocks} ADD title VARCHAR(64) NOT NULL DEFAULT ''"); + break; + case 'pgsql': + db_add_column($ret, 'blocks', 'title', 'varchar(64)', array('default' => '', 'not null' => TRUE)); + break; + } + // Migrate custom block titles to new column. + $boxes = db_query('SELECT bid, title from {boxes}'); + while ($box = db_fetch_object($boxes)) { + db_query("UPDATE {blocks} SET title = '%s' WHERE delta = %d and module = 'block'", $box->title, $box->bid); + } + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql('ALTER TABLE {boxes} DROP title'); + break; + case 'pgsql': + $ret[] = update_sql('ALTER TABLE {boxes} DROP COLUMN title'); + break; + } + return $ret; +} + /** * @} End of "defgroup updates-4.7-to-x.x" * The next series of updates should start at 2000. |