Merge branch 'dev' into 'dev'

another DB update to fix uid_mid index in item table and add xchan_photo_m index to xchan table

See merge request hubzilla/core!1641
This commit is contained in:
Max Kostikov 2019-05-08 23:30:48 +02:00
commit 44d5cf980a
4 changed files with 44 additions and 4 deletions

38
Zotlabs/Update/_1233.php Normal file
View File

@ -0,0 +1,38 @@
<?php
namespace Zotlabs\Update;
class _1233 {
function run() {
q("START TRANSACTION");
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("DROP INDEX item_uid_mid");
$r2 = q("create index item_uid_mid on item (uid, mid)");
$r3 = q("create index xchan_photo_m on xchan (xchan_photo_m)");
$r = ($r1 && $r2 && $r3);
}
else {
$r1 = q("ALTER TABLE item DROP INDEX uid_mid");
$r2 = q("ALTER TABLE item ADD INDEX uid_mid (uid, mid)");
$r3 = q("ALTER TABLE xchan ADD INDEX xchan_photo_m (xchan_photo_m)");
$r = ($r1 && $r2 && $r3);
}
if($r) {
q("COMMIT");
return UPDATE_SUCCESS;
}
q("ROLLBACK");
return UPDATE_FAILED;
}
}

View File

@ -53,7 +53,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '4.1.2' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1232 );
define ( 'DB_UPDATE_VERSION', 1233 );
define ( 'PROJECT_BASE', __DIR__ );

View File

@ -665,7 +665,7 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `mimetype` (`mimetype`),
KEY `mid` (`mid`),
KEY `parent_mid` (`parent_mid`),
KEY `uid_mid` (`mid`,`uid`),
KEY `uid_mid` (`uid`,`mid`),
KEY `comment_policy` (`comment_policy`),
KEY `layout_mid` (`layout_mid`),
KEY `public_policy` (`public_policy`),
@ -1324,7 +1324,8 @@ CREATE TABLE IF NOT EXISTS `xchan` (
KEY `xchan_selfcensored` (`xchan_selfcensored`),
KEY `xchan_system` (`xchan_system`),
KEY `xchan_pubforum` (`xchan_pubforum`),
KEY `xchan_deleted` (`xchan_deleted`)
KEY `xchan_deleted` (`xchan_deleted`),
KEY `xchan_photo_m` (`xchan_photo_m`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS `xchat` (

View File

@ -650,7 +650,7 @@ create index "item_revision" on item ("revision");
create index "item_mimetype" on item ("mimetype");
create index "item_mid" on item ("mid");
create index "item_parent_mid" on item ("parent_mid");
create index "item_uid_mid" on item ("mid","uid");
create index "item_uid_mid" on item ("uid","mid");
create index "item_public_policy" on item ("public_policy");
create index "item_comment_policy" on item ("comment_policy");
create index "item_layout_mid" on item ("layout_mid");
@ -1312,6 +1312,7 @@ create index "xchan_selfcensored" on xchan ("xchan_selfcensored");
create index "xchan_system" on xchan ("xchan_system");
create index "xchan_pubforum" on xchan ("xchan_pubforum");
create index "xchan_deleted" on xchan ("xchan_deleted");
create index "xchan_photo_m" on xchan ("xchan_photo_m");
CREATE TABLE "xchat" (
"xchat_id" serial NOT NULL,