migrations/Version20240708065741.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 Version20240708065741 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 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))');
  19.         $this->addSql('CREATE INDEX IDX_2CB20DCAF63FE6A ON shipment (main_shipment_id)');
  20.         $this->addSql('CREATE INDEX IDX_2CB20DC9D7A6668 ON shipment (source_application_id)');
  21.         $this->addSql('CREATE INDEX IDX_2CB20DCDE12AB56 ON shipment (created_by)');
  22.         $this->addSql('CREATE INDEX IDX_2CB20DC16FE72E1 ON shipment (updated_by)');
  23.         $this->addSql('COMMENT ON COLUMN shipment.id IS \'(DC2Type:uuid)\'');
  24.         $this->addSql('COMMENT ON COLUMN shipment.main_shipment_id IS \'(DC2Type:uuid)\'');
  25.         $this->addSql('COMMENT ON COLUMN shipment.source_application_id IS \'(DC2Type:uuid)\'');
  26.         $this->addSql('COMMENT ON COLUMN shipment.created_by IS \'(DC2Type:uuid)\'');
  27.         $this->addSql('COMMENT ON COLUMN shipment.updated_by IS \'(DC2Type:uuid)\'');
  28.         $this->addSql('CREATE TABLE shipment_attachment (id UUID NOT NULL, attachment_id UUID DEFAULT NULL, shipment_id UUID DEFAULT NULL, PRIMARY KEY(id))');
  29.         $this->addSql('CREATE UNIQUE INDEX UNIQ_28BBCA87464E68B ON shipment_attachment (attachment_id)');
  30.         $this->addSql('CREATE INDEX IDX_28BBCA877BE036FC ON shipment_attachment (shipment_id)');
  31.         $this->addSql('COMMENT ON COLUMN shipment_attachment.id IS \'(DC2Type:uuid)\'');
  32.         $this->addSql('COMMENT ON COLUMN shipment_attachment.attachment_id IS \'(DC2Type:uuid)\'');
  33.         $this->addSql('COMMENT ON COLUMN shipment_attachment.shipment_id IS \'(DC2Type:uuid)\'');
  34.         $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCAF63FE6A FOREIGN KEY (main_shipment_id) REFERENCES shipment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  35.         $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC9D7A6668 FOREIGN KEY (source_application_id) REFERENCES application (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  36.         $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DCDE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  37.         $this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC16FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  38.         $this->addSql('ALTER TABLE shipment_attachment ADD CONSTRAINT FK_28BBCA87464E68B FOREIGN KEY (attachment_id) REFERENCES attachment (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
  39.         $this->addSql('ALTER TABLE shipment_attachment ADD CONSTRAINT FK_28BBCA877BE036FC FOREIGN KEY (shipment_id) REFERENCES shipment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  40.     }
  41.     public function down(Schema $schema): void
  42.     {
  43.         // this down() migration is auto-generated, please modify it to your needs
  44.         $this->addSql('CREATE SCHEMA public');
  45.         $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCAF63FE6A');
  46.         $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC9D7A6668');
  47.         $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DCDE12AB56');
  48.         $this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC16FE72E1');
  49.         $this->addSql('ALTER TABLE shipment_attachment DROP CONSTRAINT FK_28BBCA87464E68B');
  50.         $this->addSql('ALTER TABLE shipment_attachment DROP CONSTRAINT FK_28BBCA877BE036FC');
  51.         $this->addSql('DROP TABLE shipment');
  52.         $this->addSql('DROP TABLE shipment_attachment');
  53.     }
  54. }