<?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 Version20201120220550 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('CREATE TABLE absence (id INT AUTO_INCREMENT NOT NULL, zak_id INT DEFAULT NULL, ucitele_id INT DEFAULT NULL, pritomen TINYINT(1) NOT NULL, datum DATE NOT NULL, poznamka VARCHAR(255) DEFAULT NULL, INDEX IDX_765AE0C9CA0EBDD9 (zak_id), INDEX IDX_765AE0C9D084CBD5 (ucitele_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE absence ADD CONSTRAINT FK_765AE0C9CA0EBDD9 FOREIGN KEY (zak_id) REFERENCES zak (id)');
        $this->addSql('ALTER TABLE absence ADD CONSTRAINT FK_765AE0C9D084CBD5 FOREIGN KEY (ucitele_id) REFERENCES ucitele (id)');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE absence');
    }
}
