fix item_id table

This commit is contained in:
friendica 2012-09-17 01:34:05 -07:00
parent 59d98647fb
commit 640f5306f5
3 changed files with 16 additions and 3 deletions

View file

@ -13,7 +13,7 @@ require_once('library/Mobile_Detect/Mobile_Detect.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '3.0.1468' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1155 );
define ( 'DB_UPDATE_VERSION', 1156 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -592,11 +592,13 @@ CREATE TABLE IF NOT EXISTS `item` (
--
CREATE TABLE IF NOT EXISTS `item_id` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
`sid` char(255) NOT NULL,
`service` char(255) NOT NULL,
PRIMARY KEY (`iid`),
PRIMARY KEY (`id`),
KEY `iid` (`iid`),
KEY `uid` (`uid`),
KEY `sid` (`sid`),
KEY `service` (`service`)

View file

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1155 );
define( 'UPDATE_VERSION' , 1156 );
/**
*
@ -1351,3 +1351,14 @@ function update_1154() {
return UPDATE_SUCCESS;
}
function update_1155() {
$r1 = q("ALTER TABLE `item_id` DROP PRIMARY KEY");
$r2 = q("ALTER TABLE `item_id` ADD `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
$r3 = q("ALTER TABLE `item_id` ADD INDEX ( `iid` ) ");
if($r1 && $r2 && $r3)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}