Skip to content

Commit

Permalink
made email unqiue
Browse files Browse the repository at this point in the history
  • Loading branch information
qr committed Aug 18, 2020
1 parent 08c4e11 commit ba6831d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Entity/Gebruiker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @ORM\Entity(repositoryClass="GemeenteAmsterdam\FixxxSchuldhulp\Repository\GebruikerRepository")
* @ORM\Table(
* uniqueConstraints={
* @ORM\UniqueConstraint(name="uq_username", columns={"username"})
* @ORM\UniqueConstraint(name="uq_username", columns={"username"}),
* @ORM\UniqueConstraint(name="uq_email", columns={"email"})
* }
* )
*/
Expand Down
29 changes: 29 additions & 0 deletions src/Migrations/Version20200818095526.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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 Version20200818095526 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE UNIQUE INDEX uq_email ON gebruiker (email)');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');

$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP INDEX uq_email');
}
}

0 comments on commit ba6831d

Please sign in to comment.