migrations/Version20221204071902.php line 1

  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 Version20221204071902 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 SEQUENCE upload_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE TABLE upload (id INT NOT NULL, creator_id INT DEFAULT NULL, created_date_time TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, modified_date_time TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, hash VARCHAR(36) NOT NULL, label VARCHAR(256) NOT NULL, length BIGINT NOT NULL, path VARCHAR(256) NOT NULL, PRIMARY KEY(id))');
  20.         $this->addSql('CREATE INDEX IDX_17BDE61F61220EA6 ON upload (creator_id)');
  21.         $this->addSql('ALTER TABLE upload ADD CONSTRAINT FK_17BDE61F61220EA6 FOREIGN KEY (creator_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->addSql('ALTER TABLE upload DROP CONSTRAINT FK_17BDE61F61220EA6');
  27.         $this->addSql('DROP TABLE upload');
  28.         $this->addSql('DROP SEQUENCE upload_id_seq CASCADE');
  29.     }
  30. }