<?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 Version20220223001500 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 booking (id INT AUTO_INCREMENT NOT NULL, subscription_id INT NOT NULL, date DATE NOT NULL, time_from TIME NOT NULL, time_to TIME NOT NULL, INDEX IDX_E00CEDDE9A1887DC (subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE pack (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, category VARCHAR(255) NOT NULL, type VARCHAR(255) DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, available_places INT DEFAULT NULL, price INT DEFAULT NULL, duration INT DEFAULT NULL, date_add DATETIME NOT NULL, date_update DATETIME NOT NULL, status INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE subscription (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, pack_id INT NOT NULL, places INT NOT NULL, date_add DATETIME NOT NULL, date_update DATETIME NOT NULL, status INT NOT NULL, INDEX IDX_A3C664D3A76ED395 (user_id), INDEX IDX_A3C664D31919B217 (pack_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE booking ADD CONSTRAINT FK_E00CEDDE9A1887DC FOREIGN KEY (subscription_id) REFERENCES subscription (id)');
$this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D31919B217 FOREIGN KEY (pack_id) REFERENCES pack (id)');
$this->addSql('ALTER TABLE article DROP author');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE subscription DROP FOREIGN KEY FK_A3C664D31919B217');
$this->addSql('ALTER TABLE booking DROP FOREIGN KEY FK_E00CEDDE9A1887DC');
$this->addSql('DROP TABLE booking');
$this->addSql('DROP TABLE pack');
$this->addSql('DROP TABLE subscription');
$this->addSql('ALTER TABLE article ADD author LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
}
}