migrations/Version20210817071439.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 Version20210817071439 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 document (id INT AUTO_INCREMENT NOT NULL, program_id INT NOT NULL, user_created_id INT NOT NULL, name VARCHAR(255) NOT NULL, path VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, visible TINYINT(1) NOT NULL, INDEX IDX_D8698A763EB8070A (program_id), INDEX IDX_D8698A76F987D8A8 (user_created_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE document_lot (id INT AUTO_INCREMENT NOT NULL, document_id INT NOT NULL, lot_id INT NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_D82BDBFFC33F7837 (document_id), INDEX IDX_D82BDBFFA8CBA5F7 (lot_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A763EB8070A FOREIGN KEY (program_id) REFERENCES programme (id)');
  21.         $this->addSql('ALTER TABLE document ADD CONSTRAINT FK_D8698A76F987D8A8 FOREIGN KEY (user_created_id) REFERENCES app_users (id)');
  22.         $this->addSql('ALTER TABLE document_lot ADD CONSTRAINT FK_D82BDBFFC33F7837 FOREIGN KEY (document_id) REFERENCES document (id)');
  23.         $this->addSql('ALTER TABLE document_lot ADD CONSTRAINT FK_D82BDBFFA8CBA5F7 FOREIGN KEY (lot_id) REFERENCES lot (id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE document_lot DROP FOREIGN KEY FK_D82BDBFFC33F7837');
  29.         $this->addSql('CREATE TABLE programme_user_consult (programme_id INT NOT NULL, user_consult_id INT NOT NULL, INDEX IDX_3B529669F760A74 (user_consult_id), INDEX IDX_3B5296662BB7AEE (programme_id), PRIMARY KEY(programme_id, user_consult_id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  30.         $this->addSql('ALTER TABLE programme_user_consult ADD CONSTRAINT FK_3B5296662BB7AEE FOREIGN KEY (programme_id) REFERENCES programme (id)');
  31.         $this->addSql('ALTER TABLE programme_user_consult ADD CONSTRAINT FK_3B529669F760A74 FOREIGN KEY (user_consult_id) REFERENCES app_users (id)');
  32.         $this->addSql('DROP TABLE document');
  33.         $this->addSql('DROP TABLE document_lot');
  34.     }
  35. }