<?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 Version20240708065741 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 TABLE shipment (id UUID NOT NULL, main_shipment_id UUID DEFAULT NULL, source_application_id UUID DEFAULT NULL, created_by UUID DEFAULT NULL, updated_by UUID DEFAULT NULL, external_id VARCHAR(255) DEFAULT NULL, sender_name TEXT DEFAULT NULL, sender_firstname TEXT DEFAULT NULL, sender_lastname TEXT DEFAULT NULL, sender_nip TEXT DEFAULT NULL, sender_pesel TEXT DEFAULT NULL, sender_street TEXT DEFAULT NULL, sender_street_number TEXT DEFAULT NULL, sender_home_number TEXT DEFAULT NULL, sender_city TEXT DEFAULT NULL, sender_postal_code TEXT DEFAULT NULL, sender_post_office TEXT DEFAULT NULL, sender_regon TEXT DEFAULT NULL, sender_krs TEXT DEFAULT NULL, sender_email TEXT DEFAULT NULL, sender_phone_number TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_2CB20DCAF63FE6A ON shipment (main_shipment_id)');
$this->addSql('CREATE INDEX IDX_2CB20DC9D7A6668 ON shipment (source_application_id)');
$this->addSql('CREATE INDEX IDX_2CB20DCDE12AB56 ON shipment (created_by)');
$this->addSql('CREATE INDEX IDX_2CB20DC16FE72E1 ON shipment (updated_by)');
$this->addSql('COMMENT ON COLUMN shipment.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment.main_shipment_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment.source_application_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment.created_by IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment.updated_by IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE shipment_attachment (id UUID NOT NULL, attachment_id UUID DEFAULT NULL, shipment_id UUID DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_28BBCA87464E68B ON shipment_attachment (attachment_id)');
$this->addSql('CREATE INDEX IDX_28BBCA877BE036FC ON shipment_attachment (shipment_id)');
$this->addSql('COMMENT ON COLUMN shipment_attachment.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment_attachment.attachment_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN shipment_attachment.shipment_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCAF63FE6A FOREIGN KEY (main_shipment_id) REFERENCES shipment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC9D7A6668 FOREIGN KEY (source_application_id) REFERENCES application (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCDE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC16FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shipment_attachment ADD CONSTRAINT FK_28BBCA87464E68B FOREIGN KEY (attachment_id) REFERENCES attachment (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shipment_attachment ADD CONSTRAINT FK_28BBCA877BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id) 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('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCAF63FE6A');
$this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC9D7A6668');
$this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCDE12AB56');
$this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC16FE72E1');
$this->addSql('ALTER TABLE shipment_attachment DROP CONSTRAINT FK_28BBCA87464E68B');
$this->addSql('ALTER TABLE shipment_attachment DROP CONSTRAINT FK_28BBCA877BE036FC');
$this->addSql('DROP TABLE shipment');
$this->addSql('DROP TABLE shipment_attachment');
}
}