<?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 Version20220922090337 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 SEQUENCE appeal_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE frequency_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE appeal (id INT NOT NULL, fio VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, phone VARCHAR(255) DEFAULT NULL, message TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE frequency (id INT NOT NULL, region_id INT NOT NULL, radio_id INT NOT NULL, frequency VARCHAR(255) NOT NULL, sd_stream VARCHAR(255) DEFAULT NULL, hd_stream VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_267FB81398260155 ON frequency (region_id)');
$this->addSql('CREATE INDEX IDX_267FB8135B94ADD2 ON frequency (radio_id)');
$this->addSql('ALTER TABLE frequency ADD CONSTRAINT FK_267FB81398260155 FOREIGN KEY (region_id) REFERENCES region (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE frequency ADD CONSTRAINT FK_267FB8135B94ADD2 FOREIGN KEY (radio_id) REFERENCES radio (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE radio DROP sd_stream');
$this->addSql('ALTER TABLE radio DROP hd_stream');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE appeal_id_seq CASCADE');
$this->addSql('DROP SEQUENCE frequency_id_seq CASCADE');
$this->addSql('ALTER TABLE frequency DROP CONSTRAINT FK_267FB81398260155');
$this->addSql('ALTER TABLE frequency DROP CONSTRAINT FK_267FB8135B94ADD2');
$this->addSql('DROP TABLE appeal');
$this->addSql('DROP TABLE frequency');
$this->addSql('ALTER TABLE radio ADD sd_stream VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE radio ADD hd_stream VARCHAR(255) NOT NULL');
}
}