<?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 Version20221104135922 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 events (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, album_id INT DEFAULT NULL, biblio_id INT DEFAULT NULL, banner_id INT DEFAULT NULL, start_date DATE DEFAULT NULL, start_time TIME DEFAULT NULL, end_date DATE DEFAULT NULL, end_time TIME DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, details LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, is_enabled TINYINT(1) DEFAULT NULL, date DATETIME DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, INDEX IDX_5387574AB03A8386 (created_by_id), UNIQUE INDEX UNIQ_5387574A1137ABCF (album_id), UNIQUE INDEX UNIQ_5387574A56407ABA (biblio_id), UNIQUE INDEX UNIQ_5387574A684EC833 (banner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE events_tags (events_id INT NOT NULL, tags_id INT NOT NULL, INDEX IDX_3EC905C9D6A1065 (events_id), INDEX IDX_3EC905C8D7B4FB4 (tags_id), PRIMARY KEY(events_id, tags_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE professions (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, banner_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, is_enabled TINYINT(1) DEFAULT NULL, slug VARCHAR(255) DEFAULT NULL, INDEX IDX_2FDA85FAB03A8386 (created_by_id), UNIQUE INDEX UNIQ_2FDA85FA684EC833 (banner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE events ADD CONSTRAINT FK_5387574AB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE events ADD CONSTRAINT FK_5387574A1137ABCF FOREIGN KEY (album_id) REFERENCES albums (id)');
$this->addSql('ALTER TABLE events ADD CONSTRAINT FK_5387574A56407ABA FOREIGN KEY (biblio_id) REFERENCES biblios (id)');
$this->addSql('ALTER TABLE events ADD CONSTRAINT FK_5387574A684EC833 FOREIGN KEY (banner_id) REFERENCES picture (id)');
$this->addSql('ALTER TABLE events_tags ADD CONSTRAINT FK_3EC905C9D6A1065 FOREIGN KEY (events_id) REFERENCES events (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE events_tags ADD CONSTRAINT FK_3EC905C8D7B4FB4 FOREIGN KEY (tags_id) REFERENCES tags (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE professions ADD CONSTRAINT FK_2FDA85FAB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE professions ADD CONSTRAINT FK_2FDA85FA684EC833 FOREIGN KEY (banner_id) REFERENCES picture (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE events_tags DROP FOREIGN KEY FK_3EC905C9D6A1065');
$this->addSql('DROP TABLE events');
$this->addSql('DROP TABLE events_tags');
$this->addSql('DROP TABLE professions');
}
}