migrations/Version20230412125414.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20230412125414 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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))');
  19.         $this->addSql('CREATE INDEX IDX_472C087532C8A3DE ON organization_site_indicator (organization_id)');
  20.         $this->addSql('CREATE INDEX IDX_472C08758F8818F9 ON organization_site_indicator (site_indicator_id)');
  21.         $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');
  22.         $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');
  23.         $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))');
  24.         $this->addSql('CREATE INDEX IDX_A62FDB8A32C8A3DE ON organization_achievement (organization_id)');
  25.         $this->addSql('COMMENT ON TABLE organization_achievement IS \'Достижения (для страниц внешнего сайта)\'');
  26.         $this->addSql('COMMENT ON COLUMN organization_achievement.content IS \'Текст достижения\'');
  27.         $this->addSql('COMMENT ON COLUMN organization_achievement.year IS \'Год достижения (Null если без года)\'');
  28.         $this->addSql('ALTER TABLE organization_achievement ADD CONSTRAINT FK_A62FDB8A32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         // this down() migration is auto-generated, please modify it to your needs
  33.         $this->addSql('ALTER TABLE organization_site_indicator DROP CONSTRAINT FK_472C087532C8A3DE');
  34.         $this->addSql('ALTER TABLE organization_site_indicator DROP CONSTRAINT FK_472C08758F8818F9');
  35.         $this->addSql('DROP TABLE organization_site_indicator');
  36.         $this->addSql('ALTER TABLE organization_achievement DROP CONSTRAINT FK_A62FDB8A32C8A3DE');
  37.         $this->addSql('DROP TABLE organization_achievement');
  38.     }
  39. }