Return STRAIGHT_JOIN back, change key in fof_item_tag

master
vitalif 2012-11-28 22:16:43 +00:00
parent 96cf22ae6d
commit 055bd05953
2 changed files with 6 additions and 3 deletions

View File

@ -353,8 +353,7 @@ function fof_db_get_items($user_id = 1, $feed = NULL, $what = "unread",
}
$args = array();
// FIXME Add STRAIGHT_JOIN here for MySQL < 5.5
$select = "SELECT SQL_NO_CACHE i.* , f.*, s.subscription_prefs ";
$select = "SELECT STRAIGHT_JOIN i.* , f.*, s.subscription_prefs ";
$from = "$FOF_ITEM_TABLE i, $FOF_FEED_TABLE f, $FOF_SUBSCRIPTION_TABLE s ";
$where = "WHERE s.user_id=$user_id AND s.feed_id=f.feed_id AND f.feed_id=i.feed_id ";

View File

@ -221,7 +221,7 @@ CREATE TABLE IF NOT EXISTS `$FOF_ITEM_TAG_TABLE` (
`user_id` int(11) NOT NULL default '0',
`item_id` int(11) NOT NULL default '0',
`tag_id` int(11) NOT NULL default '0',
PRIMARY KEY (`user_id`,`item_id`,`tag_id`),
PRIMARY KEY (`tag_id`,`user_id`,`item_id`),
FOREIGN KEY (`tag_id`) REFERENCES `$FOF_TAG_TABLE` (`tag_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`user_id`) REFERENCES `$FOF_USER_TABLE` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (`item_id`) REFERENCES `$FOF_ITEM_TABLE` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -266,6 +266,10 @@ if (!mysql_num_rows(fof_db_query("show columns from $FOF_ITEM_TABLE like 'item_a
!fof_db_query("ALTER TABLE $FOF_ITEM_TABLE ADD `item_author` text NOT NULL AFTER `item_title`;"))
exit("Can't add column item_author to table $FOF_ITEM_TABLE. MySQL says: <b>" . mysql_error() . "</b><br>");
# FIXME: Need to update:
# alter table fof_item drop key feed_id, add key item_published (item_published);
# alter table fof_item_tag drop primary key, drop key tag_id, add primary key (tag_id, user_id, item_id), add key user_id (user_id);
?>
Schema up to date.<hr>