migrations/Version20220223001500.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220223001500 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $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');
  21.         $this->addSql('ALTER TABLE booking ADD CONSTRAINT FK_E00CEDDE9A1887DC FOREIGN KEY (subscription_id) REFERENCES subscription (id)');
  22.         $this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  23.         $this->addSql('ALTER TABLE subscription ADD CONSTRAINT FK_A3C664D31919B217 FOREIGN KEY (pack_id) REFERENCES pack (id)');
  24.         $this->addSql('ALTER TABLE article DROP author');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE subscription DROP FOREIGN KEY FK_A3C664D31919B217');
  30.         $this->addSql('ALTER TABLE booking DROP FOREIGN KEY FK_E00CEDDE9A1887DC');
  31.         $this->addSql('DROP TABLE booking');
  32.         $this->addSql('DROP TABLE pack');
  33.         $this->addSql('DROP TABLE subscription');
  34.         $this->addSql('ALTER TABLE article ADD author LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  35.     }
  36. }