<?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 Version20220209120930 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE path (id INT AUTO_INCREMENT NOT NULL, origin_id INT NOT NULL, destination_id INT NOT NULL, name VARCHAR(255) NOT NULL, position SMALLINT NOT NULL, INDEX IDX_B548B0F56A273CC (origin_id), INDEX IDX_B548B0F816C6140 (destination_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE place (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, nickname VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE path ADD CONSTRAINT FK_B548B0F56A273CC FOREIGN KEY (origin_id) REFERENCES place (id)');
$this->addSql('ALTER TABLE path ADD CONSTRAINT FK_B548B0F816C6140 FOREIGN KEY (destination_id) REFERENCES place (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE path DROP FOREIGN KEY FK_B548B0F56A273CC');
$this->addSql('ALTER TABLE path DROP FOREIGN KEY FK_B548B0F816C6140');
$this->addSql('DROP TABLE path');
$this->addSql('DROP TABLE place');
$this->addSql('DROP TABLE user');
}
}