mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 09:45:29 +00:00
feat: add indexes in db
This commit is contained in:
parent
9c74833ed6
commit
acaf4fe594
37
migrations/Version20251106131135.php
Normal file
37
migrations/Version20251106131135.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20251106131135 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add indexes';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE INDEX domain_entity_roles_idx ON domain_entity USING GIN (roles)');
|
||||
$this->addSql('CREATE INDEX domain_event_action_idx ON domain_event (action)');
|
||||
$this->addSql('CREATE INDEX entity_event_action_idx ON entity_event (action)');
|
||||
$this->addSql('CREATE INDEX icann_accreditation_status_idx ON icann_accreditation (status)');
|
||||
$this->addSql('CREATE INDEX tld_type_idx ON tld (type)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX domain_entity_roles_idx');
|
||||
$this->addSql('DROP INDEX icann_accreditation_status_idx');
|
||||
$this->addSql('DROP INDEX tld_type_idx');
|
||||
$this->addSql('DROP INDEX domain_event_action_idx');
|
||||
$this->addSql('DROP INDEX entity_event_action_idx');
|
||||
}
|
||||
}
|
||||
@ -60,6 +60,9 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
'ds:list',
|
||||
],
|
||||
],
|
||||
parameters: [
|
||||
'forced' => new QueryParameter(schema: ['type' => 'boolean'], description: 'Force an RDAP request', required: false),
|
||||
],
|
||||
),
|
||||
],
|
||||
provider: AutoRegisterDomainProvider::class
|
||||
|
||||
@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ORM\Entity(repositoryClass: DomainEntityRepository::class)]
|
||||
#[ORM\Index(name: 'domain_entity_roles_idx', columns: ['roles'])]
|
||||
class DomainEntity
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
||||
@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['action', 'date', 'domain_id']
|
||||
)]
|
||||
#[ORM\Index(name: 'domain_event_action_idx', columns: ['action'])]
|
||||
class DomainEvent extends Event
|
||||
{
|
||||
#[ORM\ManyToOne(targetEntity: Domain::class, inversedBy: 'events')]
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\EntityRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@ -15,30 +14,6 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['tld_id', 'handle']
|
||||
)]
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
/*
|
||||
new GetCollection(
|
||||
uriTemplate: '/entities',
|
||||
normalizationContext: ['groups' => ['entity:list', 'event:list']]
|
||||
),
|
||||
|
||||
new Get(
|
||||
uriTemplate: '/entities/{id}',
|
||||
normalizationContext: [
|
||||
'groups' => [
|
||||
'event:list',
|
||||
'entity:item',
|
||||
'domain-entity:domain',
|
||||
'domain:list',
|
||||
'nameserver-entity:nameserver',
|
||||
'nameserver:list',
|
||||
],
|
||||
]
|
||||
),
|
||||
*/
|
||||
]
|
||||
)]
|
||||
class Entity
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
||||
@ -9,6 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
#[ORM\UniqueConstraint(
|
||||
columns: ['action', 'date', 'entity_uid']
|
||||
)]
|
||||
#[ORM\Index(name: 'entity_event_action_idx', columns: ['action'])]
|
||||
class EntityEvent extends Event
|
||||
{
|
||||
#[ORM\ManyToOne(targetEntity: Entity::class, inversedBy: 'events')]
|
||||
|
||||
@ -50,6 +50,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
||||
]
|
||||
)]
|
||||
#[ORM\Entity(repositoryClass: IcannAccreditationRepository::class)]
|
||||
#[ORM\Index(name: 'icann_accreditation_status_idx', columns: ['status'])]
|
||||
class IcannAccreditation
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
||||
@ -31,6 +31,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
||||
)]
|
||||
#[ApiFilter(SearchFilter::class)]
|
||||
#[ORM\Entity(repositoryClass: TldRepository::class)]
|
||||
#[ORM\Index(name: 'tld_type_idx', columns: ['type'])]
|
||||
class Tld
|
||||
{
|
||||
#[ORM\Id]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user