Normalize names for indices enforced by Doctrine
This commit is contained in:
parent
15a8d3b279
commit
335088ec25
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version0003 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Normalize names for indices enforced by Doctrine';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER INDEX username_uniq RENAME TO user_username_uniq');
|
||||
$this->addSql('ALTER INDEX idx_366ea16a7e3c61f9 RENAME TO user_access_token_owner_idx');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER INDEX user_access_token_owner_idx RENAME TO idx_366ea16a7e3c61f9');
|
||||
$this->addSql('ALTER INDEX user_username_uniq RENAME TO username_uniq');
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||
#[
|
||||
ORM\Entity(repositoryClass: UserRepository::class),
|
||||
ORM\Table(name: '"user"'),
|
||||
ORM\UniqueConstraint(name: 'username_uniq', fields: [AppParameters::SECURITY_USER_ENTITY_ID_FIELD]),
|
||||
ORM\UniqueConstraint(name: 'user_username_uniq', fields: [AppParameters::SECURITY_USER_ENTITY_ID_FIELD]),
|
||||
]
|
||||
class User extends BaseEntity
|
||||
implements BaseEntityInterface, UserInterface, PasswordAuthenticatedUserInterface, JsonSerializable
|
||||
|
|
|
@ -16,6 +16,7 @@ use JsonSerializable;
|
|||
ORM\Entity(repositoryClass: UserAccessTokenRepository::class),
|
||||
ORM\Table(name: 'user_access_token'),
|
||||
ORM\UniqueConstraint(name: 'value_uniq', fields: ['value']),
|
||||
ORM\Index(fields: ['owner'], name: 'user_access_token_owner_idx'),
|
||||
]
|
||||
class UserAccessToken extends BaseEntity implements BaseEntityInterface, JsonSerializable
|
||||
{
|
||||
|
|
Reference in New Issue