mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Add migration with new index for short_url_id+potential_bot on visits table
This commit is contained in:
27
data/migrations/Version20230211171904.php
Normal file
27
data/migrations/Version20230211171904.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ShlinkMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20230211171904 extends AbstractMigration
|
||||||
|
{
|
||||||
|
private const INDEX_NAME = 'IDX_visits_potential_bot';
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$visits = $schema->getTable('visits');
|
||||||
|
$this->skipIf($visits->hasIndex(self::INDEX_NAME));
|
||||||
|
|
||||||
|
$visits->addIndex(['short_url_id', 'potential_bot'], self::INDEX_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isTransactional(): bool
|
||||||
|
{
|
||||||
|
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user