Files
Inventory/migrations/Version20261120120000.php

29 lines
787 B
PHP

<?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');
}
}