chore(migrations): normaliser le schema
This commit is contained in:
28
migrations/Version20261120120000.php
Normal file
28
migrations/Version20261120120000.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 Version20261120120000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add email column to profiles when missing.';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE profiles ADD COLUMN IF NOT EXISTS email VARCHAR(180) DEFAULT NULL');
|
||||
$this->addSql('CREATE UNIQUE INDEX IF NOT EXISTS uniq_profiles_email ON profiles (email)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP INDEX IF EXISTS uniq_profiles_email');
|
||||
$this->addSql('ALTER TABLE profiles DROP COLUMN IF EXISTS email');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user