migrations/Version20231203014152.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 Version20231203014152 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('DROP SEQUENCE sport_tatarstan_imported_federations_id_seq CASCADE');
  19.         $this->addSql('DROP SEQUENCE sport_tatarstan_imported_objects_id_seq CASCADE');
  20.         $this->addSql('CREATE TABLE sport_tatarstan_federations (id SERIAL NOT NULL, organization_id INT DEFAULT NULL, name TEXT DEFAULT NULL, address TEXT DEFAULT NULL, phone TEXT DEFAULT NULL, email TEXT DEFAULT NULL, site_url TEXT DEFAULT NULL, image_url TEXT DEFAULT NULL, external_link VARCHAR(255) NOT NULL, import_status VARCHAR(255) DEFAULT NULL, page_source TEXT DEFAULT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_3B1AF3EB32C8A3DE ON sport_tatarstan_federations (organization_id)');
  22.         $this->addSql('CREATE TABLE sport_tatarstan_objects (id SERIAL NOT NULL, sport_object_id INT DEFAULT NULL, name TEXT DEFAULT NULL, address TEXT 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, legal_entity_info TEXT DEFAULT NULL, head_firstname VARCHAR(255) DEFAULT NULL, head_secondname VARCHAR(255) DEFAULT NULL, head_lastname VARCHAR(255) DEFAULT NULL, external_link VARCHAR(255) NOT NULL, import_status VARCHAR(255) DEFAULT NULL, yandex_uri VARCHAR(500) DEFAULT NULL, yandex_data JSON DEFAULT NULL, page_source TEXT DEFAULT NULL, PRIMARY KEY(id))');
  23.         $this->addSql('CREATE UNIQUE INDEX UNIQ_E3EDC3B08AFAE46 ON sport_tatarstan_objects (sport_object_id)');
  24.         $this->addSql('CREATE TABLE sport_tatarstan_rejected_objects (id SERIAL NOT NULL, url VARCHAR(255) NOT NULL, reason TEXT DEFAULT NULL, PRIMARY KEY(id))');
  25.         $this->addSql('CREATE TABLE sport_tatarstan_schools (id SERIAL NOT NULL, organization_id INT DEFAULT NULL, name TEXT DEFAULT NULL, address TEXT DEFAULT NULL, site_url TEXT DEFAULT NULL, slider_images JSON DEFAULT NULL, external_link VARCHAR(255) NOT NULL, import_status VARCHAR(255) DEFAULT NULL, yandex_id BIGINT DEFAULT NULL, yandex_data JSON DEFAULT NULL, page_source TEXT DEFAULT NULL, PRIMARY KEY(id))');
  26.         $this->addSql('CREATE UNIQUE INDEX UNIQ_16B3349632C8A3DE ON sport_tatarstan_schools (organization_id)');
  27.         $this->addSql('ALTER TABLE sport_tatarstan_federations ADD CONSTRAINT FK_3B1AF3EB32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE sport_tatarstan_objects ADD CONSTRAINT FK_E3EDC3B08AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE sport_tatarstan_schools ADD CONSTRAINT FK_16B3349632C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  30.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT fk_3ed262c732c8a3de');
  31.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT fk_3ed262c78afae46');
  32.         $this->addSql('ALTER TABLE sport_tatarstan_imported_federations DROP CONSTRAINT fk_b5f4d8cc32c8a3de');
  33.         $this->addSql('DROP TABLE sport_tatarstan_imported_objects');
  34.         $this->addSql('DROP TABLE sport_tatarstan_imported_federations');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         // this down() migration is auto-generated, please modify it to your needs
  39.         $this->addSql('CREATE SCHEMA public');
  40.         $this->addSql('CREATE SEQUENCE sport_tatarstan_imported_federations_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  41.         $this->addSql('CREATE SEQUENCE sport_tatarstan_imported_objects_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  42.         $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))');
  43.         $this->addSql('CREATE UNIQUE INDEX uniq_3ed262c78afae46 ON sport_tatarstan_imported_objects (sport_object_id)');
  44.         $this->addSql('CREATE UNIQUE INDEX uniq_3ed262c732c8a3de ON sport_tatarstan_imported_objects (organization_id)');
  45.         $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))');
  46.         $this->addSql('CREATE UNIQUE INDEX uniq_b5f4d8cc32c8a3de ON sport_tatarstan_imported_federations (organization_id)');
  47.         $this->addSql('ALTER TABLE sport_tatarstan_imported_objects ADD CONSTRAINT fk_3ed262c732c8a3de FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  48.         $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');
  49.         $this->addSql('ALTER TABLE sport_tatarstan_imported_federations ADD CONSTRAINT fk_b5f4d8cc32c8a3de FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  50.         $this->addSql('ALTER TABLE sport_tatarstan_federations DROP CONSTRAINT FK_3B1AF3EB32C8A3DE');
  51.         $this->addSql('ALTER TABLE sport_tatarstan_objects DROP CONSTRAINT FK_E3EDC3B08AFAE46');
  52.         $this->addSql('ALTER TABLE sport_tatarstan_schools DROP CONSTRAINT FK_16B3349632C8A3DE');
  53.         $this->addSql('DROP TABLE sport_tatarstan_federations');
  54.         $this->addSql('DROP TABLE sport_tatarstan_objects');
  55.         $this->addSql('DROP TABLE sport_tatarstan_rejected_objects');
  56.         $this->addSql('DROP TABLE sport_tatarstan_schools');
  57.     }
  58. }