migrations/Delete/Version20241011190123_ExpeditingBox.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Delete;
use App\Doctrine\Type\Expediting\CasingMaterial;
use App\Doctrine\Type\Expediting\CasingType;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241011190123_ExpeditingBox extends AbstractMigration
{
public function getDescription(): string
{
return 'Add expediting box';
}
public function up(Schema $schema): void
{
$casingTypeType = CasingType::getName();
$casingMaterialType = CasingMaterial::getName();
$this->addSql("CREATE TABLE expediting_z_box (
id SERIAL PRIMARY KEY,
container_id INTEGER REFERENCES expediting_z_container (id),
repacking_id INTEGER REFERENCES public.company (id),
slug CHARACTER VARYING NOT NULL,
reference CHARACTER VARYING NOT NULL,
order_numbers CHARACTER VARYING,
pickup_country_code CHARACTER VARYING,
vendor CHARACTER VARYING,
batch CHARACTER VARYING,
hub CHARACTER VARYING,
jv BOOLEAN,
dg BOOLEAN,
casing_type {$casingTypeType},
casing_material {$casingMaterialType},
length DECIMAL(18, 3),
width DECIMAL(18, 3),
height DECIMAL(18, 3),
weight DECIMAL(18, 3),
shipping_weight DECIMAL(18, 3),
value DECIMAL(18, 2),
items JSONB NOT NULL,
created_by INTEGER 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_box_slug_key UNIQUE (slug),
CONSTRAINT expediting_z_box_reference_key UNIQUE (reference)
)");
$this->addSql("COMMENT ON COLUMN expediting_z_box.items IS '(DC2Type:json_document)'");
$this->addSql("CREATE INDEX expediting_z_box_batch_idx ON expediting_z_box (batch)");
$this->addSql("CREATE INDEX expediting_z_box_order_numbers_idx ON expediting_z_box (order_numbers)");
$this->addSql("CREATE INDEX expediting_z_container_container_id_idx ON expediting_z_box (container_id)");
$this->addSql("CREATE INDEX expediting_z_container_repacking_id_idx ON expediting_z_box (repacking_id)");
$this->addSql("CREATE INDEX expediting_z_box_created_by_idx ON expediting_z_box (created_by)");
$this->addSql("CREATE INDEX expediting_z_box_updated_by_idx ON expediting_z_box (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS expediting_z_box");
}
}