migrations/Expediting/Version20200309095920_ExpeditingRepacking.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Expediting;
use App\Doctrine\Type\Expediting\RepackingMotivation;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200309095920_ExpeditingRepacking extends AbstractMigration
{
public function getDescription(): string
{
return 'Add repacking table';
}
public function up(Schema $schema): void
{
$repackingMotivationType = RepackingMotivation::getName();
$this->addSql("CREATE TABLE expediting_repacking (
id SERIAL PRIMARY KEY,
identifier UUID NOT NULL,
completed_at TIMESTAMP(0) WITH TIME ZONE NOT NULL,
motivation {$repackingMotivationType} NOT NULL,
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_repacking_identifier_key UNIQUE (identifier)
)");
$this->addSql("COMMENT ON COLUMN expediting_repacking.identifier IS '(DC2Type:ulid)'");
$this->addSql("CREATE INDEX expediting_repacking_created_by_idx ON expediting_repacking (created_by)");
$this->addSql("CREATE INDEX expediting_repacking_updated_by_idx ON expediting_repacking (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS expediting_repacking");
}
}