migrations/Version20230522091854.php line 1

Open in your IDE?
  1. <?php
  2. /* @noinspection PhpUnused */
  3. declare(strict_types=1);
  4. namespace DoctrineMigrations;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20230522091854 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // this up() migration is auto-generated, please modify it to your needs
  19.         $this->addSql(
  20.             '
  21.                 CREATE TABLE oim_measures_stored_documents (
  22.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  23.                     oim_measure_id INT NOT NULL COMMENT \'Internal ID\',
  24.                     stored_document_id INT NOT NULL COMMENT \'Internal ID\',
  25.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  26.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  27.                     INDEX IDX_EBBD6F386106C3DC (oim_measure_id),
  28.                     UNIQUE INDEX UNIQ_EBBD6F386A5BB371 (stored_document_id),
  29.                     PRIMARY KEY(id)
  30.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  31.             '
  32.         );
  33.         $this->addSql(
  34.             '
  35.                 ALTER TABLE oim_measures_stored_documents ADD CONSTRAINT FK_EBBD6F386106C3DC
  36.                     FOREIGN KEY (oim_measure_id) REFERENCES oim_measures (id)
  37.             '
  38.         );
  39.         $this->addSql(
  40.             '
  41.                 ALTER TABLE oim_measures_stored_documents ADD CONSTRAINT FK_EBBD6F386A5BB371
  42.                     FOREIGN KEY (stored_document_id) REFERENCES stored_documents (id)
  43.             '
  44.         );
  45.     }
  46.     public function down(Schema $schema): void
  47.     {
  48.         // this down() migration is auto-generated, please modify it to your needs
  49.         $this->addSql('ALTER TABLE oim_measures_stored_documents DROP FOREIGN KEY FK_EBBD6F386106C3DC');
  50.         $this->addSql('ALTER TABLE oim_measures_stored_documents DROP FOREIGN KEY FK_EBBD6F386A5BB371');
  51.         $this->addSql('DROP TABLE oim_measures_stored_documents');
  52.     }
  53. }