chore(migrations): normaliser le schema
This commit is contained in:
28
migrations/Version20261120123000.php
Normal file
28
migrations/Version20261120123000.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20261120123000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Ensure profiles.email exists (camelCase schema).';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE public.profiles ADD COLUMN IF NOT EXISTS email VARCHAR(180) DEFAULT NULL');
|
||||
$this->addSql('CREATE UNIQUE INDEX IF NOT EXISTS uniq_profiles_email ON public.profiles (email)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX IF EXISTS uniq_profiles_email');
|
||||
$this->addSql('ALTER TABLE public.profiles DROP COLUMN IF EXISTS email');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user