<?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 Version20230211231756 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 theme (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, icon VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE program (id INT AUTO_INCREMENT NOT NULL, politician_id INT DEFAULT NULL, theme_id INT DEFAULT NULL, status VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_92ED7784899F0176 (politician_id), INDEX IDX_92ED778459027487 (theme_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE program ADD CONSTRAINT FK_92ED7784899F0176 FOREIGN KEY (politician_id) REFERENCES politician (id)');
$this->addSql('ALTER TABLE program ADD CONSTRAINT FK_92ED778459027487 FOREIGN KEY (theme_id) REFERENCES theme (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE theme');
$this->addSql('ALTER TABLE program DROP FOREIGN KEY FK_92ED7784899F0176');
$this->addSql('ALTER TABLE program DROP FOREIGN KEY FK_92ED778459027487');
$this->addSql('DROP TABLE program');
}
}