migrations/Delete/Version20241210130543_InventoryWithdrawal.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Delete;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241210130543_InventoryWithdrawal extends AbstractMigration
{
public function getDescription(): string
{
return 'Add inventory withdrawal table';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE inventory_x_withdrawal (
id SERIAL PRIMARY KEY,
slug CHARACTER VARYING NOT NULL,
reference CHARACTER VARYING NOT NULL,
type CHARACTER VARYING,
consumer CHARACTER VARYING,
reason CHARACTER VARYING,
requested_for TIMESTAMP(0) WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
accepted_at TIMESTAMP(0) WITH TIME ZONE,
processed_at TIMESTAMP(0) WITH TIME ZONE,
picked_at TIMESTAMP(0) WITH TIME ZONE,
rejected_at TIMESTAMP(0) WITH TIME ZONE,
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 inventory_x_withdrawal_slug_key UNIQUE (slug),
CONSTRAINT inventory_x_withdrawal_reference_key UNIQUE (reference)
)');
$this->addSql("CREATE INDEX inventory_x_withdrawal_created_by_idx ON inventory_x_withdrawal (created_by)");
$this->addSql("CREATE INDEX inventory_x_withdrawal_updated_by_idx ON inventory_x_withdrawal (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS inventory_x_withdrawal');
}
}