<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230412114536 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE site_indicator (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, value DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
$this->addSql('COMMENT ON TABLE site_indicator IS \'Показатели на странице внешнего сайта (статистика)\'');
$this->addSql('COMMENT ON COLUMN site_indicator.name IS \'Наименование показателя\'');
$this->addSql('COMMENT ON COLUMN site_indicator.value IS \'Значение показателя (число)\'');
$this->addSql('CREATE TABLE site_section_site_indicator (site_section_id INT NOT NULL, site_indicator_id INT NOT NULL, PRIMARY KEY(site_section_id, site_indicator_id))');
$this->addSql('CREATE INDEX IDX_D874A43EF82A6CBF ON site_section_site_indicator (site_section_id)');
$this->addSql('CREATE INDEX IDX_D874A43E8F8818F9 ON site_section_site_indicator (site_indicator_id)');
$this->addSql('ALTER TABLE site_section_site_indicator ADD CONSTRAINT FK_D874A43EF82A6CBF FOREIGN KEY (site_section_id) REFERENCES site_section (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE site_section_site_indicator ADD CONSTRAINT FK_D874A43E8F8818F9 FOREIGN KEY (site_indicator_id) REFERENCES site_indicator (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE site_section_site_indicator DROP CONSTRAINT FK_D874A43EF82A6CBF');
$this->addSql('ALTER TABLE site_section_site_indicator DROP CONSTRAINT FK_D874A43E8F8818F9');
$this->addSql('DROP TABLE site_indicator');
$this->addSql('DROP TABLE site_section_site_indicator');
}
}