mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
adding indexes
This commit is contained in:
parent
38c272f89e
commit
d1083e97cb
@ -7,3 +7,8 @@ Version 1.5.1
|
||||
- add a filtering by center on list;
|
||||
- add color in boxes for task statuses;
|
||||
|
||||
Branch `master`
|
||||
===============
|
||||
|
||||
- adding indexes on place event and task
|
||||
|
||||
|
@ -9,7 +9,19 @@ use Doctrine\Common\Collections\Collection;
|
||||
/**
|
||||
* SingleTask
|
||||
*
|
||||
* @ORM\Table("chill_task.single_task")
|
||||
* @ORM\Table(
|
||||
* "chill_task.single_task",
|
||||
* indexes={
|
||||
* @ORM\Index(
|
||||
* name="by_type",
|
||||
* columns={ "type" }
|
||||
* ),
|
||||
* @ORM\Index(
|
||||
* name="by_current_state",
|
||||
* columns={ "current_states" }
|
||||
* )
|
||||
* }
|
||||
* )
|
||||
* @ORM\Entity(repositoryClass="Chill\TaskBundle\Repository\SingleTaskRepository")
|
||||
*/
|
||||
class SingleTask extends AbstractTask
|
||||
|
@ -23,7 +23,18 @@ use Chill\TaskBundle\Entity\SingleTask;
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @ORM\Table("chill_task.single_task_place_event")
|
||||
* @ORM\Table(
|
||||
* "chill_task.single_task_place_event",
|
||||
* indexes={
|
||||
* @ORM\Index(
|
||||
* name="transition_task_date",
|
||||
* columns={"task_id", "transition", "datetime"}
|
||||
* ),
|
||||
* @ORM\Index(
|
||||
* name="transition_task",
|
||||
* columns={"task_id", "transition"}
|
||||
* )
|
||||
* })
|
||||
* @ORM\Entity()
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
|
29
Resources/migrations/Version20181113161925.php
Normal file
29
Resources/migrations/Version20181113161925.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add index on single_task_place_events
|
||||
*/
|
||||
final class Version20181113161925 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 transition_task_date ON chill_task.single_task_place_event (task_id, transition, datetime)');
|
||||
$this->addSql('CREATE INDEX transition_task ON chill_task.single_task_place_event (task_id, transition)');
|
||||
}
|
||||
|
||||
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 transition_task_date');
|
||||
$this->addSql('DROP INDEX transition_task');
|
||||
|
||||
}
|
||||
}
|
28
Resources/migrations/Version20181113164108.php
Normal file
28
Resources/migrations/Version20181113164108.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user