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

This commit is contained in:
Mario Vavti
2019-05-08 20:12:54 +02:00
parent 5bf9a9828c
commit e53650d6c6
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;
}
}