<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220911101221 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add manager role';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE manager (id BIGINT UNSIGNED NOT NULL, sponsor_id BIGINT UNSIGNED DEFAULT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_FA2425B912F7FB51 (sponsor_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE manager ADD CONSTRAINT FK_FA2425B912F7FB51 FOREIGN KEY (sponsor_id) REFERENCES sponsor (id)');
$this->addSql('ALTER TABLE manager ADD CONSTRAINT FK_FA2425B9BF396750 FOREIGN KEY (id) REFERENCES user (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE manager');
}
public function isTransactional(): bool
{
return false;
}
}