<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250603081004 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE ezd_documents_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$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))');
$this->addSql('CREATE INDEX IDX_3E7E1803CF10D4F5 ON ezd_documents (case_id)');
$this->addSql('CREATE INDEX IDX_3E7E18037BE036FC ON ezd_documents (shipment_id)');
$this->addSql('COMMENT ON COLUMN ezd_documents.case_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN ezd_documents.shipment_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN ezd_documents.ezd_document_id IS \'IdDokumentu\'');
$this->addSql('COMMENT ON COLUMN ezd_documents.ezd_folder_id IS \'id koszulki\'');
$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');
$this->addSql('ALTER TABLE ezd_documents ADD CONSTRAINT FK_3E7E18037BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE ezd_documents_id_seq CASCADE');
$this->addSql('ALTER TABLE ezd_documents DROP CONSTRAINT FK_3E7E1803CF10D4F5');
$this->addSql('ALTER TABLE ezd_documents DROP CONSTRAINT FK_3E7E18037BE036FC');
$this->addSql('DROP TABLE ezd_documents');
}
}