migrations/Version20230412114536.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 Version20230412114536 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 site_indicator (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, value DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('COMMENT ON TABLE site_indicator IS \'Показатели на странице внешнего сайта (статистика)\'');
  20.         $this->addSql('COMMENT ON COLUMN site_indicator.name IS \'Наименование показателя\'');
  21.         $this->addSql('COMMENT ON COLUMN site_indicator.value IS \'Значение показателя (число)\'');
  22.         $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))');
  23.         $this->addSql('CREATE INDEX IDX_D874A43EF82A6CBF ON site_section_site_indicator (site_section_id)');
  24.         $this->addSql('CREATE INDEX IDX_D874A43E8F8818F9 ON site_section_site_indicator (site_indicator_id)');
  25.         $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');
  26.         $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');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE site_section_site_indicator DROP CONSTRAINT FK_D874A43EF82A6CBF');
  32.         $this->addSql('ALTER TABLE site_section_site_indicator DROP CONSTRAINT FK_D874A43E8F8818F9');
  33.         $this->addSql('DROP TABLE site_indicator');
  34.         $this->addSql('DROP TABLE site_section_site_indicator');
  35.     }
  36. }