migrations/Delete/Version20241011153450_ExpeditingContainer.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Delete;
use App\Doctrine\Type\Expediting\ContainerSize;
use App\Doctrine\Type\Expediting\ContainerType;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241011153450_ExpeditingContainer extends AbstractMigration
{
public function getDescription(): string
{
return 'Add expediting container';
}
public function up(Schema $schema): void
{
$containerTypeType = ContainerType::getName();
$containerSizeType = ContainerSize::getName();
$this->addSql("CREATE TABLE expediting_z_container (
id SERIAL PRIMARY KEY,
batch_id INTEGER REFERENCES expediting_z_batch (id),
seal_number CHARACTER VARYING,
identification_number CHARACTER VARYING,
container_type {$containerTypeType} NOT NULL,
container_size {$containerSizeType} NOT NULL,
tare_weight DECIMAL(18, 2),
gross_weight DECIMAL(18, 2),
volume DECIMAL(18, 2),
created_by INTEGER NOT NULL REFERENCES public.user (id),
updated_by INTEGER REFERENCES public.user (id),
created_at TIMESTAMP(0) WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP(0) WITH TIME ZONE,
deleted_at TIMESTAMP(0) WITH TIME ZONE,
CONSTRAINT expediting_z_container_seal_number_key UNIQUE (seal_number)
)");
$this->addSql("CREATE INDEX expediting_z_container_batch_id_idx ON expediting_z_container (batch_id)");
$this->addSql("CREATE INDEX expediting_z_container_created_by_idx ON expediting_z_container (created_by)");
$this->addSql("CREATE INDEX expediting_z_container_updated_by_idx ON expediting_z_container (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS expediting_z_container");
}
}