<?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 Version20230412125414 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 organization_site_indicator (organization_id INT NOT NULL, site_indicator_id INT NOT NULL, PRIMARY KEY(organization_id, site_indicator_id))');
$this->addSql('CREATE INDEX IDX_472C087532C8A3DE ON organization_site_indicator (organization_id)');
$this->addSql('CREATE INDEX IDX_472C08758F8818F9 ON organization_site_indicator (site_indicator_id)');
$this->addSql('ALTER TABLE organization_site_indicator ADD CONSTRAINT FK_472C087532C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE organization_site_indicator ADD CONSTRAINT FK_472C08758F8818F9 FOREIGN KEY (site_indicator_id) REFERENCES site_indicator (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE TABLE organization_achievement (id SERIAL NOT NULL, organization_id INT DEFAULT NULL, content TEXT NOT NULL, year INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_A62FDB8A32C8A3DE ON organization_achievement (organization_id)');
$this->addSql('COMMENT ON TABLE organization_achievement IS \'Достижения (для страниц внешнего сайта)\'');
$this->addSql('COMMENT ON COLUMN organization_achievement.content IS \'Текст достижения\'');
$this->addSql('COMMENT ON COLUMN organization_achievement.year IS \'Год достижения (Null если без года)\'');
$this->addSql('ALTER TABLE organization_achievement ADD CONSTRAINT FK_A62FDB8A32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) 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 organization_site_indicator DROP CONSTRAINT FK_472C087532C8A3DE');
$this->addSql('ALTER TABLE organization_site_indicator DROP CONSTRAINT FK_472C08758F8818F9');
$this->addSql('DROP TABLE organization_site_indicator');
$this->addSql('ALTER TABLE organization_achievement DROP CONSTRAINT FK_A62FDB8A32C8A3DE');
$this->addSql('DROP TABLE organization_achievement');
}
}