migrations/Version20231130141903.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 Version20231130141903 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 sport_tatarstan_imported_federations (id SERIAL NOT NULL, organization_id INT DEFAULT NULL, phone TEXT DEFAULT NULL, email TEXT DEFAULT NULL, site_url TEXT DEFAULT NULL, image_url TEXT DEFAULT NULL, external_link TEXT DEFAULT NULL, import_status VARCHAR(255) DEFAULT NULL, yandex_id VARCHAR(255) DEFAULT NULL, name TEXT DEFAULT NULL, reject_reason TEXT DEFAULT NULL, source TEXT DEFAULT NULL, PRIMARY KEY(id))');
  19.         $this->addSql('CREATE UNIQUE INDEX UNIQ_B5F4D8CC32C8A3DE ON sport_tatarstan_imported_federations (organization_id)');
  20.         $this->addSql('CREATE TABLE sport_tatarstan_imported_objects (id SERIAL NOT NULL, sport_object_id INT DEFAULT NULL, organization_id INT DEFAULT NULL, phone TEXT DEFAULT NULL, email TEXT DEFAULT NULL, site_url TEXT DEFAULT NULL, slider_images JSON DEFAULT NULL, description TEXT DEFAULT NULL, visiting_requirements TEXT DEFAULT NULL, object_composition TEXT DEFAULT NULL, available_environment TEXT DEFAULT NULL, ownership_type TEXT DEFAULT NULL, external_link TEXT DEFAULT NULL, import_status VARCHAR(255) DEFAULT NULL, yandex_id VARCHAR(255) DEFAULT NULL, name TEXT DEFAULT NULL, yandex_data TEXT DEFAULT NULL, reject_reason TEXT DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, source TEXT DEFAULT NULL, legal_entity_info TEXT DEFAULT NULL, head_full_name JSON DEFAULT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_3ED262C78AFAE46 ON sport_tatarstan_imported_objects (sport_object_id)');
  22.         $this->addSql('CREATE UNIQUE INDEX UNIQ_3ED262C732C8A3DE ON sport_tatarstan_imported_objects (organization_id)');
  23.         $this->addSql('ALTER TABLE sport_tatarstan_imported_federations ADD CONSTRAINT FK_B5F4D8CC32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects ADD CONSTRAINT FK_3ED262C78AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects ADD CONSTRAINT FK_3ED262C732C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('CREATE SCHEMA public');
  31.         $this->addSql('ALTER TABLE sport_tatarstan_imported_federations DROP CONSTRAINT FK_B5F4D8CC32C8A3DE');
  32.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT FK_3ED262C78AFAE46');
  33.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT FK_3ED262C732C8A3DE');
  34.         $this->addSql('DROP TABLE sport_tatarstan_imported_federations');
  35.         $this->addSql('DROP TABLE sport_tatarstan_imported_objects');
  36.     }
  37. }