mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
29 lines
958 B
PHP
29 lines
958 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace Chill\Migrations\Task;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* Add index on single task
|
|
*/
|
|
final class Version20181113164108 extends AbstractMigration
|
|
{
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
|
|
|
$this->addSql('CREATE INDEX by_type ON chill_task.single_task (type)');
|
|
$this->addSql('CREATE INDEX by_current_state ON chill_task.single_task USING GIN (current_states)');
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
|
|
|
$this->addSql('DROP INDEX by_type');
|
|
$this->addSql('DROP INDEX by_current_state');
|
|
}
|
|
}
|