Skip to content

Commit

Permalink
fix: Sync indexes on NodesSources entity and NodesSourcesInheritanceS…
Browse files Browse the repository at this point in the history
…ubscriber
  • Loading branch information
ambroisemaupate committed Jul 13, 2024
1 parent 3db3793 commit a604e8b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions lib/RoadizCoreBundle/migrations/Version20240713204610.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace RZ\Roadiz\Migrations;

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

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

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE INDEX ns_no_index ON nodes_sources (no_index)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX ns_no_index ON nodes_sources');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
['columns' => ['discr']],
['columns' => ['title']],
['columns' => ['published_at']],
'ns_no_index' => ['columns' => ['no_index']],
'ns_node_translation_published' => ['columns' => ['node_id', 'translation_id', 'published_at']],
'ns_node_discr_translation' => ['columns' => ['node_id', 'discr', 'translation_id']],
'ns_node_discr_translation_published' => ['columns' => ['node_id', 'discr', 'translation_id', 'published_at']],
Expand Down
2 changes: 1 addition & 1 deletion lib/RoadizCoreBundle/src/Entity/NodesSources.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
ORM\Index(columns: ["discr"]),
ORM\Index(columns: ["title"]),
ORM\Index(columns: ["published_at"]),
ORM\Index(columns: ["no_index"]),
ORM\Index(columns: ["no_index"], name: 'ns_no_index'),
ORM\Index(columns: ["node_id", "translation_id", "published_at"], name: "ns_node_translation_published"),
ORM\Index(columns: ["node_id", "discr", "translation_id"], name: "ns_node_discr_translation"),
ORM\Index(columns: ["node_id", "discr", "translation_id", "published_at"], name: "ns_node_discr_translation_published"),
Expand Down

0 comments on commit a604e8b

Please sign in to comment.