2010-09-09 03:14:17 +00:00
< ? php
2013-08-22 00:15:56 +00:00
define ( 'UPDATE_VERSION' , 1064 );
2011-06-03 08:16:17 +00:00
2010-12-10 04:41:42 +00:00
/**
*
* update . php - automatic system update
*
* Automatically update database schemas and any other development changes such that
* copying the latest files from the source code repository will always perform a clean
* and painless upgrade .
*
2012-12-10 00:28:35 +00:00
* Each function in this file is named update_rnnnn () where nnnn is an increasing number
2010-12-10 04:41:42 +00:00
* which began counting at 1000.
*
2011-03-10 00:57:22 +00:00
* At the top of the file " boot.php " is a define for DB_UPDATE_VERSION . Any time there is a change
2010-12-10 04:41:42 +00:00
* to the database schema or one which requires an upgrade path from the existing application ,
2011-06-29 06:20:58 +00:00
* the DB_UPDATE_VERSION and the UPDATE_VERSION at the top of this file are incremented .
2010-12-10 04:41:42 +00:00
*
2011-03-10 00:57:22 +00:00
* The current DB_UPDATE_VERSION is stored in the config area of the database . If the application starts up
* and DB_UPDATE_VERSION is greater than the last stored build number , we will process every update function
* in order from the currently stored value to the new DB_UPDATE_VERSION . This is expected to bring the system
2010-12-10 04:41:42 +00:00
* up to current without requiring re - installation or manual intervention .
*
2011-03-10 00:57:22 +00:00
* Once the upgrade functions have completed , the current DB_UPDATE_VERSION is stored as the current value .
* The DB_UPDATE_VERSION will always be one greater than the last numbered script in this file .
2010-12-10 04:41:42 +00:00
*
* If you change the database schema , the following are required :
* 1. Update the file database . sql to match the new schema .
2011-03-10 00:57:22 +00:00
* 2. Update this file by adding a new function at the end with the number of the current DB_UPDATE_VERSION .
2010-12-10 04:41:42 +00:00
* This function should modify the current database schema and perform any other steps necessary
* to ensure that upgrade is silent and free from requiring interaction .
2011-06-03 08:16:17 +00:00
* 3. Increment the DB_UPDATE_VERSION in boot . php * AND * the UPDATE_VERSION in this file to match it
2010-12-10 04:41:42 +00:00
* 4. TEST the upgrade prior to checkin and filing a pull request .
*
*/
2012-12-10 21:44:54 +00:00
function update_r1000 () {
$r = q ( " ALTER TABLE `channel` ADD `channel_a_delegate` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0', ADD INDEX ( `channel_a_delegate` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2010-12-10 04:41:42 +00:00
2012-12-14 08:45:30 +00:00
function update_r1001 () {
$r = q ( " CREATE TABLE if not exists `verify` (
`id` INT ( 10 ) UNSIGNED NOT NULL ,
`channel` INT ( 10 ) UNSIGNED NOT NULL DEFAULT '0' ,
`type` CHAR ( 32 ) NOT NULL DEFAULT '' ,
`token` CHAR ( 255 ) NOT NULL DEFAULT '' ,
`meta` CHAR ( 255 ) NOT NULL DEFAULT '' ,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
PRIMARY KEY ( `id` )
2013-03-06 05:00:25 +00:00
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
2012-12-14 08:45:30 +00:00
$r2 = q ( " alter table `verify` add index (`channel`), add index (`type`), add index (`token`),
add index ( `meta` ), add index ( `created` ) " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-19 00:17:08 +00:00
function update_r1002 () {
$r = q ( " ALTER TABLE `event` CHANGE `account` `aid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' " );
$r2 = q ( " alter table `event` drop index `account`, add index (`aid`) " );
2012-12-19 00:29:57 +00:00
q ( " drop table contact " );
q ( " drop table deliverq " );
2012-12-19 00:17:08 +00:00
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-20 06:45:49 +00:00
function update_r1003 () {
$r = q ( " ALTER TABLE `xchan` ADD `xchan_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `xchan_network` ,
ADD INDEX ( `xchan_flags` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
function update_r1004 () {
$r = q ( " CREATE TABLE if not exists `site` (
`site_url` CHAR ( 255 ) NOT NULL ,
`site_flags` INT NOT NULL DEFAULT '0' ,
`site_update` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`site_directory` CHAR ( 255 ) NOT NULL DEFAULT '' ,
PRIMARY KEY ( `site_url` )
2013-03-06 05:00:25 +00:00
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
2012-12-20 06:45:49 +00:00
$r2 = q ( " alter table site add index (site_flags), add index (site_update), add index (site_directory) " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
2012-12-21 06:53:50 +00:00
}
function update_r1005 () {
q ( " drop table guid " );
2012-12-21 12:08:48 +00:00
q ( " drop table `notify-threads` " );
2012-12-21 06:53:50 +00:00
return UPDATE_SUCCESS ;
2012-12-21 11:34:17 +00:00
}
function update_r1006 () {
$r = q ( " CREATE TABLE IF NOT EXISTS `xprof` (
`xprof_hash` char ( 255 ) NOT NULL ,
`xprof_desc` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_dob` char ( 12 ) NOT NULL DEFAULT '' ,
`xprof_gender` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_marital` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_sexual` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_locale` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_region` char ( 255 ) NOT NULL DEFAULT '' ,
`xprof_postcode` char ( 32 ) NOT NULL DEFAULT '' ,
`xprof_country` char ( 255 ) NOT NULL DEFAULT '' ,
PRIMARY KEY ( `xprof_hash` ),
KEY `xprof_desc` ( `xprof_desc` ),
KEY `xprof_dob` ( `xprof_dob` ),
KEY `xprof_gender` ( `xprof_gender` ),
KEY `xprof_marital` ( `xprof_marital` ),
KEY `xprof_sexual` ( `xprof_sexual` ),
KEY `xprof_locale` ( `xprof_locale` ),
KEY `xprof_region` ( `xprof_region` ),
KEY `xprof_postcode` ( `xprof_postcode` ),
KEY `xprof_country` ( `xprof_country` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
$r2 = q ( " CREATE TABLE IF NOT EXISTS `xtag` (
`xtag_hash` char ( 255 ) NOT NULL ,
`xtag_term` char ( 255 ) NOT NULL DEFAULT '' ,
PRIMARY KEY ( `xtag_hash` ),
KEY `xtag_term` ( `xtag_term` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
2012-12-22 11:33:12 +00:00
}
function update_r1007 () {
$r = q ( " ALTER TABLE `channel` ADD `channel_r_storage` INT UNSIGNED NOT NULL DEFAULT '128', ADD `channel_w_storage` INT UNSIGNED NOT NULL DEFAULT '128', add index ( channel_r_storage ), add index ( channel_w_storage ) " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-26 11:49:50 +00:00
function update_r1008 () {
$r = q ( " alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-27 08:57:47 +00:00
function update_r1009 () {
$r = q ( " ALTER TABLE `xprof` ADD `xprof_keywords` TEXT NOT NULL " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-28 07:33:37 +00:00
function update_r1010 () {
$r = q ( " ALTER TABLE `abook` ADD `abook_dob` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `abook_connnected` ,
ADD INDEX ( `abook_dob` ) " );
$r2 = q ( " ALTER TABLE `profile` ADD `dob_tz` CHAR( 255 ) NOT NULL DEFAULT 'UTC' AFTER `dob` " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2012-12-29 11:02:22 +00:00
function update_r1011 () {
$r = q ( " ALTER TABLE `item` ADD `expires` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ,
ADD INDEX ( `expires` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-01 09:57:20 +00:00
function update_r1012 () {
$r = q ( " ALTER TABLE `xchan` ADD `xchan_connurl` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_url` ,
ADD INDEX ( `xchan_connurl` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-02 07:56:27 +00:00
function update_r1013 () {
2013-01-02 09:30:53 +00:00
$r = q ( " CREATE TABLE if not exists `xlink` (
2013-01-02 07:56:27 +00:00
`xlink_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`xlink_xchan` CHAR ( 255 ) NOT NULL DEFAULT '' ,
`xlink_link` CHAR ( 255 ) NOT NULL DEFAULT '' ,
`xlink_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
2013-03-06 05:00:25 +00:00
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
2013-01-02 07:56:27 +00:00
2013-01-02 10:00:46 +00:00
$r2 = q ( " alter table xlink add index ( xlink_xchan ), add index ( xlink_link ), add index ( xlink_updated ) " );
2013-01-02 07:56:27 +00:00
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-03 07:07:46 +00:00
function update_r1014 () {
$r = q ( " ALTER TABLE `verify` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-15 00:17:57 +00:00
function update_r1015 () {
$r = q ( " ALTER TABLE `channel` ADD `channel_r_pages` INT UNSIGNED NOT NULL DEFAULT '128',
ADD `channel_w_pages` INT UNSIGNED NOT NULL DEFAULT '128' " );
$r2 = q ( " ALTER TABLE `channel` ADD INDEX ( `channel_r_pages` ) , ADD INDEX ( `channel_w_pages` ) " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-15 22:34:14 +00:00
function update_r1016 () {
$r = q ( " CREATE TABLE IF NOT EXISTS `menu` (
`menu_id` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`menu_channel_id` int ( 10 ) unsigned NOT NULL DEFAULT '0' ,
`menu_desc` char ( 255 ) NOT NULL DEFAULT '' ,
PRIMARY KEY ( `menu_id` ),
KEY `menu_channel_id` ( `menu_channel_id` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
$r2 = q ( " CREATE TABLE IF NOT EXISTS `menu_item` (
`mitem_id` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`mitem_link` char ( 255 ) NOT NULL DEFAULT '' ,
`mitem_desc` char ( 255 ) NOT NULL DEFAULT '' ,
`allow_cid` mediumtext NOT NULL ,
`allow_gid` mediumtext NOT NULL ,
`deny_cid` mediumtext NOT NULL ,
`deny_gid` mediumtext NOT NULL ,
`mitem_channel_id` int ( 10 ) unsigned NOT NULL ,
`mitem_menu_id` int ( 10 ) unsigned NOT NULL DEFAULT '0' ,
`mitem_order` int ( 11 ) NOT NULL DEFAULT '0' ,
PRIMARY KEY ( `mitem_id` ),
KEY `mitem_channel_id` ( `mitem_channel_id` ),
KEY `mitem_menu_id` ( `mitem_menu_id` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
if ( $r && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-16 00:48:59 +00:00
function update_r1017 () {
$r = q ( " ALTER TABLE `event` CHANGE `cid` `event_xchan` CHAR( 255 ) NOT NULL DEFAULT '', ADD INDEX ( `event_xchan` ), drop index cid " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-16 01:59:49 +00:00
function update_r1018 () {
$r = q ( " ALTER TABLE `event` ADD `event_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `event_xchan` ,
ADD INDEX ( `event_hash` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-16 08:59:43 +00:00
function update_r1019 () {
2013-01-16 10:01:23 +00:00
$r = q ( " ALTER TABLE `event` DROP `message_id` " );
2013-01-16 08:59:43 +00:00
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-23 01:48:42 +00:00
function update_r1020 () {
$r = q ( " alter table photo drop `contact-id`, drop guid, drop index `resource-id`, add index ( `resource_id` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-27 09:19:24 +00:00
function update_r1021 () {
$r = q ( " ALTER TABLE `abook` CHANGE `abook_connnected` `abook_connected` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
drop index `abook_connnected` , add index ( `abook_connected` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-31 01:27:32 +00:00
function update_r1022 () {
$r = q ( " alter table attach add index ( filename ), add index ( filetype ), add index ( filesize ), add index ( created ), add index ( edited ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-01-31 02:20:14 +00:00
function update_r1023 () {
$r = q ( " ALTER TABLE `item` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `lang` , add index ( revision ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-01 00:13:44 +00:00
function update_r1024 () {
$r = q ( " ALTER TABLE `attach` ADD `revision` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `filesize` ,
ADD INDEX ( `revision` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-04 01:22:35 +00:00
function update_r1025 () {
$r = q ( " ALTER TABLE `attach` ADD `folder` CHAR( 64 ) NOT NULL DEFAULT '' AFTER `revision` ,
ADD `flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `folder` , add index ( folder ), add index ( flags ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-11 03:00:22 +00:00
function update_r1026 () {
$r = q ( " ALTER TABLE `item` ADD `mimetype` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `author_xchan` ,
ADD INDEX ( `mimetype` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-16 03:05:00 +00:00
function update_r1027 () {
$r = q ( " ALTER TABLE `abook` ADD `abook_rating` INT NOT NULL DEFAULT '0' AFTER `abook_closeness` ,
ADD INDEX ( `abook_rating` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-16 06:34:01 +00:00
function update_r1028 () {
2013-02-16 06:37:54 +00:00
$r = q ( " ALTER TABLE `xlink` ADD `xlink_rating` INT NOT NULL DEFAULT '0' AFTER `xlink_link` ,
2013-02-16 06:34:01 +00:00
ADD INDEX ( `xlink_rating` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-18 23:15:55 +00:00
function update_r1029 () {
$r = q ( " ALTER TABLE `channel` ADD `channel_deleted` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `channel_pageflags` ,
ADD INDEX ( `channel_deleted` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-02-19 00:04:01 +00:00
function update_r1030 () {
2013-03-06 05:00:25 +00:00
$r = q ( " CREATE TABLE IF NOT EXISTS `issue` (
2013-02-19 00:04:01 +00:00
`issue_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`issue_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`issue_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`issue_assigned` CHAR ( 255 ) NOT NULL ,
`issue_priority` INT NOT NULL ,
`issue_status` INT NOT NULL ,
`issue_component` CHAR ( 255 ) NOT NULL ,
KEY `issue_created` ( `issue_created` ),
KEY `issue_updated` ( `issue_updated` ),
KEY `issue_assigned` ( `issue_assigned` ),
2013-02-19 08:20:47 +00:00
KEY `issue_priority` ( `issue_priority` ),
2013-02-19 00:04:01 +00:00
KEY `issue_status` ( `issue_status` ),
KEY `issue_component` ( `issue_component` )
2013-03-06 05:00:25 +00:00
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
2013-02-19 00:04:01 +00:00
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-01 21:42:22 +00:00
function update_r1031 () {
$r = q ( " ALTER TABLE `account` ADD `account_external` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `account_email` ,
ADD INDEX ( `account_external` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-06 05:00:25 +00:00
function update_r1032 () {
$r = q ( " CREATE TABLE if not exists `xign` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`uid` INT NOT NULL DEFAULT '0' ,
`xchan` CHAR ( 255 ) NOT NULL DEFAULT '' ,
KEY `uid` ( `uid` ),
KEY `xchan` ( `xchan` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-06 23:13:54 +00:00
function update_r1033 () {
$r = q ( " CREATE TABLE if not exists `shares` (
`share_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`share_type` INT NOT NULL DEFAULT '0' ,
`share_target` INT UNSIGNED NOT NULL DEFAULT '0' ,
`share_xchan` CHAR ( 255 ) NOT NULL DEFAULT '' ,
KEY `share_type` ( `share_type` ),
KEY `share_target` ( `share_target` ),
KEY `share_xchan` ( `share_xchan` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
// if these fail don't bother reporting it
q ( " drop table gcign " );
q ( " drop table gcontact " );
q ( " drop table glink " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-13 23:28:41 +00:00
function update_r1034 () {
$r = q ( " CREATE TABLE if not exists `updates` (
`ud_hash` CHAR ( 128 ) NOT NULL ,
`ud_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' ,
PRIMARY KEY ( `ud_hash` ),
KEY `ud_date` ( `ud_date` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-15 22:36:58 +00:00
function update_r1035 () {
$r = q ( " CREATE TABLE if not exists `xconfig` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`xchan` CHAR ( 255 ) NOT NULL ,
`cat` CHAR ( 255 ) NOT NULL ,
`k` CHAR ( 255 ) NOT NULL ,
`v` MEDIUMTEXT NOT NULL ,
KEY `xchan` ( `xchan` ),
KEY `cat` ( `cat` ),
KEY `k` ( `k` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-20 03:17:07 +00:00
function update_r1036 () {
2013-03-22 01:25:41 +00:00
$r = q ( " ALTER TABLE `profile` ADD `channels` TEXT NOT NULL AFTER `contact` " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
2013-03-20 03:17:07 +00:00
}
2013-03-22 01:25:41 +00:00
function update_r1037 () {
$r1 = q ( " ALTER TABLE `item` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '',
CHANGE `parent_uri` `parent_mid` CHAR ( 255 ) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' ,
DROP INDEX `uri` ,
ADD INDEX `mid` ( `mid` ),
DROP INDEX `parent_uri` ,
ADD INDEX `parent_mid` ( `parent_mid` ),
DROP INDEX `uid_uri` ,
ADD INDEX `uid_mid` ( `mid` , `uid` ) " );
$r2 = q ( " ALTER TABLE `mail` CHANGE `uri` `mid` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `parent_uri` `parent_mid` CHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
DROP INDEX `uri` ,
ADD INDEX `mid` ( `mid` ),
DROP INDEX `parent_uri` ,
ADD INDEX `parent_mid` ( `parent_mid` ) " );
if ( $r1 && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-28 02:02:01 +00:00
function update_r1038 () {
$r = q ( " ALTER TABLE `manage` CHANGE `mid` `xchan` CHAR( 255 ) NOT NULL DEFAULT '', drop index `mid`, ADD INDEX ( `xchan` ) " );
2013-03-22 01:25:41 +00:00
2013-03-28 02:02:01 +00:00
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-03-22 01:25:41 +00:00
2013-03-28 02:35:34 +00:00
function update_r1039 () {
$r = q ( " ALTER TABLE `channel` CHANGE `channel_default_gid` `channel_default_group` CHAR( 255 ) NOT NULL DEFAULT '' " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-05-06 02:34:56 +00:00
function update_r1040 () {
2013-05-06 09:17:20 +00:00
$r1 = q ( " ALTER TABLE `session` CHANGE `expire` `expire` BIGINT UNSIGNED NOT NULL " );
$r2 = q ( " ALTER TABLE `tokens` CHANGE `expires` `expires` BIGINT UNSIGNED NOT NULL " );
2013-05-06 02:34:56 +00:00
2013-05-06 09:17:20 +00:00
if ( $r1 && $r2 )
2013-05-06 02:34:56 +00:00
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-05-06 10:55:58 +00:00
function update_r1041 () {
$r = q ( " ALTER TABLE `outq` ADD `outq_driver` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `outq_channel` " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-05 00:46:21 +00:00
function update_r1042 () {
$r = q ( " ALTER TABLE `hubloc` ADD `hubloc_updated` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
ADD `hubloc_connected` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' , ADD INDEX ( `hubloc_updated` ), ADD INDEX ( `hubloc_connected` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-17 02:14:01 +00:00
function update_r1043 () {
$r = q ( " ALTER TABLE `item` ADD `comment_policy` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `coord` ,
ADD INDEX ( `comment_policy` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-20 01:06:14 +00:00
function update_r1044 () {
$r = q ( " ALTER TABLE `term` ADD `imgurl` CHAR( 255 ) NOT NULL ,
ADD INDEX ( `imgurl` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-21 01:36:02 +00:00
function update_r1045 () {
$r = q ( " ALTER TABLE `site` ADD `site_register` INT NOT NULL DEFAULT '0',
ADD INDEX ( `site_register` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-28 02:35:59 +00:00
function update_r1046 () {
$r = q ( " ALTER TABLE `term` ADD `term_hash` CHAR( 255 ) NOT NULL DEFAULT '',
ADD INDEX ( `term_hash` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-06-30 07:38:02 +00:00
function update_r1047 () {
$r = q ( " ALTER TABLE `xprof` ADD `xprof_age` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `xprof_hash` ,
ADD INDEX ( `xprof_age` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-03 11:28:36 +00:00
function update_r1048 () {
$r = q ( " CREATE TABLE IF NOT EXISTS `obj` (
`obj_id` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`obj_page` char ( 64 ) NOT NULL DEFAULT '' ,
`obj_verb` char ( 255 ) NOT NULL DEFAULT '' ,
`obj_type` int ( 10 ) unsigned NOT NULL DEFAULT '0' ,
`obj_obj` char ( 255 ) NOT NULL DEFAULT '' ,
`obj_channel` int ( 10 ) unsigned NOT NULL DEFAULT '0' ,
PRIMARY KEY ( `obj_id` ),
KEY `obj_verb` ( `obj_verb` ),
KEY `obj_page` ( `obj_page` ),
KEY `obj_type` ( `obj_type` ),
KEY `obj_channel` ( `obj_channel` ),
KEY `obj_obj` ( `obj_obj` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-14 08:12:05 +00:00
function update_r1049 () {
$r = q ( " ALTER TABLE `term` ADD `parent_hash` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `term_hash` , ADD INDEX ( `parent_hash` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
2013-07-15 01:52:24 +00:00
}
function update_r1050 () {
$r = q ( " ALTER TABLE `xtag` DROP PRIMARY KEY , ADD `xtag_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST , ADD INDEX ( `xtag_hash` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-16 11:46:01 +00:00
function update_r1051 () {
$r = q ( " ALTER TABLE `photo` ADD `photo_flags` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `profile` , ADD INDEX ( `photo_flags` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-18 04:38:37 +00:00
function update_r1052 () {
$r = q ( " ALTER TABLE `channel` ADD UNIQUE (`channel_address`) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-25 04:23:20 +00:00
function update_r1053 () {
$r = q ( " ALTER TABLE `profile` ADD `chandesc` TEXT NOT NULL DEFAULT '' AFTER `pdesc` " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-30 00:30:46 +00:00
function update_r1054 () {
$r = q ( " ALTER TABLE `item` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-07-31 09:32:41 +00:00
function update_r1055 () {
$r = q ( " ALTER TABLE `mail` CHANGE `title` `title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-01 23:55:37 +00:00
function update_r1056 () {
$r = q ( " ALTER TABLE `xchan` ADD `xchan_instance_url` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_network` ,
ADD INDEX ( `xchan_instance_url` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-05 00:17:00 +00:00
function update_r1057 () {
$r = q ( " drop table intro " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-12 02:04:07 +00:00
function update_r1058 () {
$r1 = q ( " ALTER TABLE `menu` ADD `menu_name` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `menu_channel_id` ,
ADD INDEX ( `menu_name` ) " );
$r2 = q ( " ALTER TABLE `menu_item` ADD `mitem_flags` INT NOT NULL DEFAULT '0' AFTER `mitem_desc` ,
ADD INDEX ( `mitem_flags` ) " );
if ( $r1 && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-20 04:19:39 +00:00
function update_r1059 () {
$r = q ( " ALTER TABLE `mail` ADD `attach` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `body` " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-21 03:39:00 +00:00
function update_r1060 () {
$r = q ( " CREATE TABLE IF NOT EXISTS `vote` (
`vote_id` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT ,
`vote_poll` int ( 11 ) NOT NULL DEFAULT '0' ,
`vote_element` int ( 11 ) NOT NULL DEFAULT '0' ,
`vote_result` text NOT NULL ,
`vote_xchan` char ( 255 ) NOT NULL DEFAULT '' ,
PRIMARY KEY ( `vote_id` ),
UNIQUE KEY `vote_vote` ( `vote_poll` , `vote_element` , `vote_xchan` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-21 08:33:20 +00:00
function update_r1061 () {
$r = q ( " ALTER TABLE `vote` ADD INDEX ( `vote_poll` ), ADD INDEX ( `vote_element` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
function update_r1062 () {
$r1 = q ( " CREATE TABLE IF NOT EXISTS `poll` (
`poll_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`poll_channel` INT UNSIGNED NOT NULL DEFAULT '0' ,
`poll_desc` TEXT NOT NULL DEFAULT '' ,
`poll_flags` INT NOT NULL DEFAULT '0' ,
`poll_votes` INT NOT NULL DEFAULT '0' ,
KEY `poll_channel` ( `poll_channel` ),
KEY `poll_flags` ( `poll_flags` ),
KEY `poll_votes` ( `poll_votes` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
$r2 = q ( " CREATE TABLE IF NOT EXISTS `poll_elm` (
`pelm_id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`pelm_poll` INT UNSIGNED NOT NULL DEFAULT '0' ,
`pelm_desc` TEXT NOT NULL DEFAULT '' ,
`pelm_flags` INT NOT NULL DEFAULT '0' ,
`pelm_result` FLOAT NOT NULL DEFAULT '0' ,
KEY `pelm_poll` ( `pelm_poll` ),
KEY `pelm_result` ( `pelm_result` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 " );
if ( $r1 && $r2 )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}
2013-08-22 00:15:56 +00:00
function update_r1063 () {
$r = q ( " ALTER TABLE `xchan` ADD `xchan_follow` CHAR( 255 ) NOT NULL DEFAULT '' AFTER `xchan_connurl` ,
ADD `xchan_connpage` CHAR ( 255 ) NOT NULL DEFAULT '' AFTER `xchan_follow` ,
ADD INDEX ( `xchan_follow` ), ADD INDEX ( `xchan_connpage` ) " );
if ( $r )
return UPDATE_SUCCESS ;
return UPDATE_FAILED ;
}