From 7d05631c812de72614f1ad55fe222bc85c72f9ba Mon Sep 17 00:00:00 2001 From: Christian Fowler Date: Wed, 25 Mar 2009 02:32:49 +0000 Subject: change ip to IPv6 compliance (39 chars). add upgrades files and remove registerPackageVersion where redundant --- admin/schema_inc.php | 4 ++-- admin/upgrades/2.1.3.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 admin/upgrades/2.1.3.php diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 85085dc..5371a1d 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -66,7 +66,7 @@ $tables = array( format_guid C(16) NOTNULL, summary XL, user_id I4 NOTNULL, - ip C(15), + ip C(39), history_comment C(200), data XL CONSTRAINT ', CONSTRAINT `liberty_history_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )' @@ -77,7 +77,7 @@ $tables = array( user_id I4 NOTNULL, last_modified I8 NOTNULL, title C(160), - ip C(15), + ip C(39), log_message C(250) NOTNULL DEFAULT '', error_message C(250) NOTNULL DEFAULT '' ", diff --git a/admin/upgrades/2.1.3.php b/admin/upgrades/2.1.3.php new file mode 100644 index 0000000..ee6ead5 --- /dev/null +++ b/admin/upgrades/2.1.3.php @@ -0,0 +1,42 @@ + LIBERTY_PKG_NAME, + 'version' => str_replace( '.php', '', basename( __FILE__ )), + 'description' => "Minor fix to ip columns to support IPv6", + 'post_upgrade' => NULL, +); + +// all we are doing is change the column type of user_id for liberty_content_history. +// postgresql < 8.2 doesn't allow easy column type changing +// and therefore we need to undergo this annoying dance. +$gBitInstaller->registerPackageUpgrade( $infoHash, array( + +// copy data into new column +array( 'QUERY' => + // postgres > 8.2 needs to have the type cast + array( + 'PGSQL' => array( "ALTER TABLE `".BIT_DB_PREFIX."users_cnxn ALTER `ip` TYPE VARCHAR(39)" , + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content ALTER `ip` TYPE VARCHAR(39)", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` ALTER `ip` TYPE VARCHAR(39)", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` ALTER `ip` TYPE VARCHAR(39)", + ), + 'OCI' => array( "ALTER TABLE `".BIT_DB_PREFIX."users_cnxn MODIFY (`ip` TYPE VARCHAR2(39))" , + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content MODIFY (`ip` TYPE VARCHAR2(39))", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` MODIFY (`ip` TYPE VARCHAR2(39))", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` MODIFY (`ip` TYPE VARCHAR2(39))", + ), + 'MYSQL' => array( "ALTER TABLE `".BIT_DB_PREFIX."users_cnxn MODIFY `ip` TYPE VARCHAR(39)" , + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content MODIFY `ip` TYPE VARCHAR(39)", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_content_history` MODIFY `ip` TYPE VARCHAR(39)", + "ALTER TABLE `".BIT_DB_PREFIX."liberty_action_log` MODIFY `ip` TYPE VARCHAR(39)", + ), + ), +), + +)); +?> -- cgit v1.3