Add database indexes for Postgres
This commit is contained in:
parent
9b4892e3ca
commit
e4c4240317
@ -11,6 +11,10 @@ function get_connection()
|
|||||||
$db = new PicoDb\Database(get_connection_parameters());
|
$db = new PicoDb\Database(get_connection_parameters());
|
||||||
$db->getStatementHandler()->withLogging();
|
$db->getStatementHandler()->withLogging();
|
||||||
|
|
||||||
|
if (DEBUG_MODE) {
|
||||||
|
$db->getStatementHandler()->withStopWatch();
|
||||||
|
}
|
||||||
|
|
||||||
if ($db->schema('\Miniflux\Schema')->check(Schema\VERSION)) {
|
if ($db->schema('\Miniflux\Schema')->check(Schema\VERSION)) {
|
||||||
return $db;
|
return $db;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Miniflux\Helper;
|
namespace Miniflux\Helper;
|
||||||
|
|
||||||
|
use PicoDb\Database;
|
||||||
use PicoFeed\Logging\Logger;
|
use PicoFeed\Logging\Logger;
|
||||||
|
|
||||||
function escape($value)
|
function escape($value)
|
||||||
@ -62,6 +63,8 @@ function is_secure_connection()
|
|||||||
|
|
||||||
function write_debug_file() {
|
function write_debug_file() {
|
||||||
if (DEBUG_MODE) {
|
if (DEBUG_MODE) {
|
||||||
file_put_contents(DEBUG_FILENAME, implode(PHP_EOL, Logger::getMessages()), FILE_APPEND|LOCK_EX);
|
$feed_logs = Logger::getMessages();
|
||||||
|
$db_logs = Database::getInstance('db')->getLogMessages();
|
||||||
|
file_put_contents(DEBUG_FILENAME, implode(PHP_EOL, array_merge($feed_logs, $db_logs)), FILE_APPEND|LOCK_EX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,4 +130,7 @@ function version_1(PDO $pdo)
|
|||||||
$fever_token,
|
$fever_token,
|
||||||
md5('admin:'.$fever_token),
|
md5('admin:'.$fever_token),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$pdo->exec('CREATE INDEX items_user_status_idx ON items(user_id, status)');
|
||||||
|
$pdo->exec('CREATE INDEX items_user_feed_idx ON items(user_id, feed_id)');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user