<?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 Version20210723134342 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
$this->addSql('CREATE TABLE residents (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, has_accepted_terms TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_F27069E4E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE flat ADD resident_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE flat ADD CONSTRAINT FK_554AAA448012C5B0 FOREIGN KEY (resident_id) REFERENCES residents (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_554AAA448012C5B0 ON flat (resident_id)');
}
public function down(Schema $schema) : void
{
$this->addSql('ALTER TABLE flat DROP FOREIGN KEY FK_554AAA448012C5B0');
$this->addSql('DROP TABLE residents');
$this->addSql('DROP INDEX IDX_554AAA448012C5B0 ON flat');
$this->addSql('ALTER TABLE flat DROP resident_id');
}
}