summaryrefslogtreecommitdiff
path: root/admin/upgrade_inc.php
blob: 5e1fd0f8c71b51ca1bd394488e73be67f0b789a4 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

global $gBitSystem, $gUpgradeFrom, $gUpgradeTo;

$upgrades = array(

	'BWR1' => array(
		'BWR2' => array(
// de-tikify tables
array( 'DATADICT' => array(
	array( 'RENAMETABLE' => array(
		'tiki_fisheye_gallery' => 'fisheye_gallery',
		'tiki_fisheye_gallery_image_map' => 'fisheye_gallery_image_map',
		'tiki_fisheye_image' => 'fisheye_image',
		'tiki_thumbnail_queue' => 'liberty_process_queue',
	)),
	array( 'RENAMESEQUENCE' => array(
		"tiki_fisheye_gallery_id_seq" => "fisheye_gallery_id_seq",
	)),
	array('ALTER'=> array(
		'fisheye_gallery_image_map' => array(
			'item_position' => array( '`item_position`', 'F' ),
		),
	)),
)),

// query: create a fisheye_image_id_seq and bring the table up to date with the current max image_id used in the fisheye_image table - this basically for mysql
array( 'PHP' => '
	$query = $gBitDb->getOne("SELECT MAX(image_id) FROM `'.BIT_DB_PREFIX.'fisheye_image`");
	$tempId = $gBitDb->mDb->GenID("`'.BIT_DB_PREFIX.'fisheye_image_id_seq`", $query);
' ),

// Queries
array( 'QUERY' =>
	array( 'SQL92' => array(
	// Copy int positions to floats
	"UPDATE `".BIT_DB_PREFIX."fisheye_gallery_image_map` SET `item_position`=`position`",
	),
)),

// DataDict cleanup
array( 'DATADICT' => array(
	array( 'DROPCOLUMN' => array(
		'fisheye_gallery_image_map' => array( '`position`' ),
	)),
	array( 'CREATEINDEX' => array(
		'fisheye_gallery_image_map_pos_idx' => array( 'fisheye_gallery_image_map', '`gallery_content_id`,`item_position`', array( 'UNIQUE' ) ),
	)),
)),

		)
	),
);

if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) {
	$gBitSystem->registerUpgrade( FISHEYE_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] );
}
?>