Skip to content

Commit

Permalink
fix: Fixed non-named inherited indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Aug 28, 2023
1 parent c153550 commit a43439c
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 2 deletions.
41 changes: 41 additions & 0 deletions lib/RoadizCoreBundle/migrations/Version20230828092821.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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 Version20230828092821 extends AbstractMigration
{
public function getDescription(): string
{
return 'Fixed inherited indexes.';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE INDEX custom_form_created_at ON custom_forms (created_at)');
$this->addSql('CREATE INDEX custom_form_updated_at ON custom_forms (updated_at)');
$this->addSql('CREATE INDEX redirection_created_at ON redirections (created_at)');
$this->addSql('CREATE INDEX redirection_updated_at ON redirections (updated_at)');
$this->addSql('CREATE INDEX idx_user_created_at ON users (created_at)');
$this->addSql('CREATE INDEX idx_user_updated_at ON users (updated_at)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX custom_form_created_at ON custom_forms');
$this->addSql('DROP INDEX custom_form_updated_at ON custom_forms');
$this->addSql('DROP INDEX redirection_created_at ON redirections');
$this->addSql('DROP INDEX redirection_updated_at ON redirections');
$this->addSql('DROP INDEX idx_user_created_at ON users');
$this->addSql('DROP INDEX idx_user_updated_at ON users');
}
}
4 changes: 3 additions & 1 deletion lib/RoadizCoreBundle/src/Entity/CustomForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
ORM\Entity(repositoryClass: CustomFormRepository::class),
ORM\Table(name: "custom_forms"),
ORM\HasLifecycleCallbacks,
UniqueEntity(fields: ["name"])
UniqueEntity(fields: ["name"]),
ORM\Index(columns: ["created_at"], name: "custom_form_created_at"),
ORM\Index(columns: ["updated_at"], name: "custom_form_updated_at"),
]
class CustomForm extends AbstractDateTimed
{
Expand Down
4 changes: 3 additions & 1 deletion lib/RoadizCoreBundle/src/Entity/Redirection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
ORM\Table(name: "redirections"),
ORM\HasLifecycleCallbacks,
UniqueEntity(fields: ["query"]),
ORM\Index(columns: ["use_count"], name: 'redirection_use_count')
ORM\Index(columns: ["use_count"], name: 'redirection_use_count'),
ORM\Index(columns: ["created_at"], name: "redirection_created_at"),
ORM\Index(columns: ["updated_at"], name: "redirection_updated_at"),
]
class Redirection extends AbstractDateTimed
{
Expand Down
2 changes: 2 additions & 0 deletions lib/RoadizCoreBundle/src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
ORM\Index(columns: ["last_login"], name: "idx_users_last_login"),
ORM\Index(columns: ["locked"], name: "idx_users_locked"),
ORM\Index(columns: ["locale"], name: "idx_users_locale"),
ORM\Index(columns: ["created_at"], name: "idx_user_created_at"),
ORM\Index(columns: ["updated_at"], name: "idx_user_updated_at"),
ORM\HasLifecycleCallbacks,
UniqueEntity("email"),
UniqueEntity("username")
Expand Down
33 changes: 33 additions & 0 deletions lib/RoadizFontBundle/migrations/Version20230828092912.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace RZ\Roadiz\FontBundle\Migrations;

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

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

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

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX font_created_at ON fonts');
$this->addSql('DROP INDEX font_updated_at ON fonts');
}
}
2 changes: 2 additions & 0 deletions lib/RoadizFontBundle/src/Entity/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
ORM\Entity(repositoryClass: FontRepository::class),
ORM\Table(name: "fonts"),
ORM\UniqueConstraint(columns: ["name", "variant"]),
ORM\Index(columns: ["created_at"], name: "font_created_at"),
ORM\Index(columns: ["updated_at"], name: "font_updated_at"),
UniqueEntity(fields: ["name", "variant"])
]
class Font extends AbstractDateTimed
Expand Down

0 comments on commit a43439c

Please sign in to comment.