migrations/Purchasing/Version20200306133210_PurchasingFlow.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Purchasing;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200306133210_PurchasingFlow extends AbstractMigration
{
public function getDescription(): string
{
return 'Add purchasing flow table';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE TABLE purchasing_flow (
id SERIAL PRIMARY KEY,
client_id INTEGER NOT NULL REFERENCES public.company (id),
contract_id INTEGER REFERENCES public.contract (id),
label CHARACTER VARYING 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 purchasing_flow_client_id_label_key UNIQUE (client_id, label)
)");
$this->addSql("CREATE INDEX purchasing_flow_client_id_idx ON purchasing_flow (client_id)");
$this->addSql("CREATE INDEX purchasing_flow_contract_id_idx ON purchasing_flow (contract_id)");
$this->addSql("CREATE INDEX purchasing_flow_created_by_idx ON purchasing_flow (created_by)");
$this->addSql("CREATE INDEX purchasing_flow_updated_by_idx ON purchasing_flow (updated_by)");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS purchasing_flow");
}
}