summaryrefslogtreecommitdiff
path: root/admin/upgrade_inc.php
blob: 3ceef25ade1e0e623d1d08fbb56b239ed5e31f4d (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php

global $gBitSystem, $gUpgradeFrom, $gUpgradeTo;

$upgrades = array(

'BWR1' => array(
	'BWR2' => array(
array( 'DATADICT' => array(
	array( 'RENAMETABLE' => array(
		'tiki_searchindex'    => 'search_index',
		'tiki_searchsyllable' => 'search_syllable',
		'tiki_search_stats'   => 'search_stats',
		'tiki_searchwords'    => 'search_words',
	)),
	array( 'RENAMECOLUMN' => array(
		'search_index' => array( '`count`' => '`i_count` I4' ),
	)),
	array( 'DROPCOLUMN' => array(
		'search_index' => array( '`location`' ),
	)),
)),
	)
),

'BONNIE' => array(
	'BWR1' => array(
// STEP 1 - Data is transient, so let's recreate the table with proper  multi-column keys
array( 'DATADICT' => array(
	array( 'DROPTABLE' => array(
		'tiki_searchindex'
	)),
	array( 'CREATE' => array (
	'tiki_searchindex' => "
		searchword C(80) PRIMARY,
		location C(80) PRIMARY,
		content_id I4 PRIMARY,
		count I4 NOTNULL default '1',
		last_update I4 NOTNULL
	",
	)),
)),

// STEP 2
array( 'DATADICT' => array(
	array( 'RENAMECOLUMN' => array(
		'tiki_searchsyllable' => array( '`lastUsed`' => '`last_used` I8',
										'`lastUpdated`' => '`last_updated` I8' ),
	)),
)),

// STEP 3
array( 'DATADICT' => array(
	array( 'CREATEINDEX' => array(
		'tiki_searchidx_con_id_idx' => array( 'tiki_searchindex', '`content_id`', array() ),
		'tiki_searchidx_word_idx' => array( 'tiki_searchindex', '`searchword`', array() ),
		'tiki_searchidx_loc_idx' => array( 'tiki_searchindex', '`location`', array() ),
		'tiki_searchidx_update_idx' => array( 'tiki_searchindex', '`last_update`', array() ),
	)),
)),

	)
)

);

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


?>