summaryrefslogtreecommitdiff
path: root/admin/upgrades/2.1.3.php
blob: e3ae654a0819f37bba193c41fbba63f84726b7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
 * @version $Header: /cvsroot/bitweaver/_bit_liberty/admin/upgrades/2.1.3.php,v 1.2 2009/03/25 08:28:11 squareing Exp $
 */
global $gBitInstaller;

$infoHash = array(
	'package'      => 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."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."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."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)",
		),
	),
),

));
?>