migrations/Version20241210120057.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.  * @package API
  11.  * @internal
  12.  */
  13. final class Version20241210120057 extends AbstractMigration
  14. {
  15.     public function down(Schema $schema): void
  16.     {
  17.         // this down() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE skill_screening_document DROP FOREIGN KEY FK_36F55D7D3D8E604F');
  19.         $this->addSql('DROP TABLE skill_screening_document');
  20.     }
  21.     public function getDescription(): string
  22.     {
  23.         return
  24.             "- Introduces skill screening document table.";
  25.     }
  26.     public function up(Schema $schema): void
  27.     {
  28.         // this up() migration is auto-generated, please modify it to your needs
  29.         $this->addSql(
  30.             '
  31.                 CREATE TABLE skill_screening_document (
  32.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  33.                     parent INT NOT NULL COMMENT \'Internal ID\',
  34.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  35.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  36.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  37.                     uuid VARCHAR(36) NOT NULL COMMENT \'UUID for file\',
  38.                     name VARCHAR(225) NOT NULL COMMENT \'Name for file\',
  39.                     mime_type VARCHAR(32) NOT NULL COMMENT \'MIME type for file\',
  40.                     hash VARCHAR(32) NOT NULL COMMENT \'Hash for file\',
  41.                     extension VARCHAR(3) NOT NULL COMMENT \'Extension for file\',
  42.                     property_name VARCHAR(32) NOT NULL COMMENT \'Property name for file\',
  43.                     UNIQUE INDEX UNIQ_36F55D7DD17F50A6 (uuid),
  44.                     INDEX IDX_36F55D7D3D8E604F (parent),
  45.                     PRIMARY KEY(id)
  46.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  47.             '
  48.         );
  49.         $this->addSql(
  50.             '
  51.                 ALTER TABLE skill_screening_document ADD CONSTRAINT FK_36F55D7D3D8E604F
  52.                     FOREIGN KEY (parent) REFERENCES skill_screening (id) ON DELETE CASCADE
  53.             '
  54.         );
  55.     }
  56. }