From f83368fdf5bd0e11d120cdd905d085276c28fe92 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 23 Jan 2007 16:44:58 +0000 Subject: - Patch #92630 by RobRoy: simplify adding new blocks. --- modules/system/system.install | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'modules/system') diff --git a/modules/system/system.install b/modules/system/system.install index e99453d54..1b11c3914 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -209,7 +209,7 @@ function system_install() { ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); db_query("CREATE TABLE {boxes} ( - bid int NOT NULL auto_increment, + bid int NOT NULL, body longtext, info varchar(128) NOT NULL default '', format int NOT NULL default '0', @@ -3515,6 +3515,23 @@ function system_update_1021() { * @todo Start this series of updates at 2000. */ +/** + * Remove auto_increment from {boxes} to allow adding custom blocks with + * visibility settings. + */ +function system_update_2000() { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $max = (int)db_result(db_query('SELECT MAX(bid) FROM {boxes}')); + $ret[] = update_sql('ALTER TABLE {boxes} CHANGE COLUMN bid bid int NOT NULL'); + $ret[] = update_sql("REPLACE INTO {sequences} VALUES ('{boxes}_bid', $max)"); + break; + } + return $ret; +} + /** * @} End of "defgroup updates-5.0-to-x.x" * The next series of updates should start at 3000. -- cgit v1.2.3