<?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 Version20240904154014 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 list_articles (id INT AUTO_INCREMENT NOT NULL, article_id INT NOT NULL, list_id INT NOT NULL, minimum INT NOT NULL, maximum INT NOT NULL, deleted TINYINT(1) NOT NULL, INDEX IDX_C1B002087294869C (article_id), INDEX IDX_C1B002083DAE168B (list_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE list_restriction (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, name VARCHAR(255) NOT NULL, deleted TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_F5262845B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE list_restriction_establishment (id INT AUTO_INCREMENT NOT NULL, list_id INT NOT NULL, created_by_id INT NOT NULL, deleted TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_574045F23DAE168B (list_id), INDEX IDX_574045F2B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE list_articles ADD CONSTRAINT FK_C1B002087294869C FOREIGN KEY (article_id) REFERENCES articles (id)');
$this->addSql('ALTER TABLE list_articles ADD CONSTRAINT FK_C1B002083DAE168B FOREIGN KEY (list_id) REFERENCES list_restriction (id)');
$this->addSql('ALTER TABLE list_restriction ADD CONSTRAINT FK_F5262845B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE list_restriction_establishment ADD CONSTRAINT FK_574045F23DAE168B FOREIGN KEY (list_id) REFERENCES list_restriction (id)');
$this->addSql('ALTER TABLE list_restriction_establishment ADD CONSTRAINT FK_574045F2B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE list_articles DROP FOREIGN KEY FK_C1B002087294869C');
$this->addSql('ALTER TABLE list_articles DROP FOREIGN KEY FK_C1B002083DAE168B');
$this->addSql('ALTER TABLE list_restriction DROP FOREIGN KEY FK_F5262845B03A8386');
$this->addSql('ALTER TABLE list_restriction_establishment DROP FOREIGN KEY FK_574045F23DAE168B');
$this->addSql('ALTER TABLE list_restriction_establishment DROP FOREIGN KEY FK_574045F2B03A8386');
$this->addSql('DROP TABLE list_articles');
$this->addSql('DROP TABLE list_restriction');
$this->addSql('DROP TABLE list_restriction_establishment');
}
}