migrations/Common/Version20200301105331_CompanyFileMap.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations\Common;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20200301105331_CompanyFileMap extends AbstractMigration
{
public function getDescription(): string
{
return 'Add company to files relations';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE company_file_map (
company_id INTEGER NOT NULL REFERENCES public.company (id),
file_id INTEGER NOT NULL REFERENCES public.file (id) NOT DEFERRABLE INITIALLY IMMEDIATE,
PRIMARY KEY (company_id, file_id)
)');
$this->addSql('CREATE INDEX company_file_map_company_id_idx ON company_file_map (company_id)');
$this->addSql('CREATE INDEX company_file_map_file_id_idx ON company_file_map (file_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS company_file_map');
}
}