Skip to content

Commit

Permalink
add missing index
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Aug 7, 2022
1 parent 3ddc7b5 commit 1c4a8be
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Migrations/Version/Version20200905081453.php
Expand Up @@ -232,7 +232,7 @@ public function up(Schema $schema) : void
$logTable->addColumn('execution_time', 'integer', ['notnull' => false, 'default' => null]);
$logTable->addColumn('date', 'datetime');
$logTable->setPrimaryKey(['id']);
$logTable->addIndex(['category_id', 'ip', 'date']);
$logTable->addIndex(['category_id', 'ip', 'date'], 'IDX_LOG_CID');
}

if (!$schema->hasTable('fusio_log_error')) {
Expand Down Expand Up @@ -310,7 +310,7 @@ public function up(Schema $schema) : void
$rateTable->addColumn('timespan', 'string');
$rateTable->setPrimaryKey(['id']);
$rateTable->addUniqueIndex(['name']);
$rateTable->addIndex(['status']);
$rateTable->addIndex(['status'], 'IDX_RATE_S');
}

if (!$schema->hasTable('fusio_rate_allocation')) {
Expand Down Expand Up @@ -356,8 +356,8 @@ public function up(Schema $schema) : void
$routesTable->setPrimaryKey(['id']);
$routesTable->addUniqueIndex(['path']);
$routesTable->addIndex(['priority']);
$routesTable->addIndex(['status']);
$routesTable->addIndex(['category_id', 'status']);
$routesTable->addIndex(['status'], 'IDX_ROUTE_S');
$routesTable->addIndex(['category_id', 'status'], 'IDX_ROUTE_CS');
}

if (!$schema->hasTable('fusio_routes_method')) {
Expand Down
47 changes: 47 additions & 0 deletions src/Migrations/Version/Version20220807091731.php
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

namespace Fusio\Impl\Migrations\Version;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220807091731 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}

public function up(Schema $schema) : void
{
$logTable = $schema->getTable('fusio_log');
if (!$logTable->hasIndex('IDX_LOG_CID')) {
$logTable->addIndex(['category_id', 'ip', 'date'], 'IDX_LOG_CID');
}

$rateTable = $schema->getTable('fusio_rate');
if (!$rateTable->hasIndex('IDX_RATE_S')) {
$rateTable->addIndex(['status'], 'IDX_RATE_S');
}

$routesTable = $schema->getTable('fusio_routes');
if (!$routesTable->hasIndex('IDX_ROUTE_S')) {
$routesTable->addIndex(['status'], 'IDX_ROUTE_S');
}

if (!$routesTable->hasIndex('IDX_ROUTE_CS')) {
$routesTable->addIndex(['category_id', 'status'], 'IDX_ROUTE_CS');
}
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs

}
}

0 comments on commit 1c4a8be

Please sign in to comment.