migrations/Version20250603081004.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 Version20250603081004 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 ezd_documents_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE TABLE ezd_documents (id INT NOT NULL, case_id UUID DEFAULT NULL, shipment_id UUID NOT NULL, ezd_document_id INT DEFAULT NULL, ezd_folder_id INT DEFAULT NULL, PRIMARY KEY(id))');
  20.         $this->addSql('CREATE INDEX IDX_3E7E1803CF10D4F5 ON ezd_documents (case_id)');
  21.         $this->addSql('CREATE INDEX IDX_3E7E18037BE036FC ON ezd_documents (shipment_id)');
  22.         $this->addSql('COMMENT ON COLUMN ezd_documents.case_id IS \'(DC2Type:uuid)\'');
  23.         $this->addSql('COMMENT ON COLUMN ezd_documents.shipment_id IS \'(DC2Type:uuid)\'');
  24.         $this->addSql('COMMENT ON COLUMN ezd_documents.ezd_document_id IS \'IdDokumentu\'');
  25.         $this->addSql('COMMENT ON COLUMN ezd_documents.ezd_folder_id IS \'id koszulki\'');
  26.         $this->addSql('ALTER TABLE ezd_documents ADD CONSTRAINT FK_3E7E1803CF10D4F5 FOREIGN KEY (case_id) REFERENCES case_entity (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('ALTER TABLE ezd_documents ADD CONSTRAINT FK_3E7E18037BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->addSql('CREATE SCHEMA public');
  33.         $this->addSql('DROP SEQUENCE ezd_documents_id_seq CASCADE');
  34.         $this->addSql('ALTER TABLE ezd_documents DROP CONSTRAINT FK_3E7E1803CF10D4F5');
  35.         $this->addSql('ALTER TABLE ezd_documents DROP CONSTRAINT FK_3E7E18037BE036FC');
  36.         $this->addSql('DROP TABLE ezd_documents');
  37.     }
  38. }