<?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 Version20231203014152 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('DROP SEQUENCE sport_tatarstan_imported_federations_id_seq CASCADE');
$this->addSql('DROP SEQUENCE sport_tatarstan_imported_objects_id_seq CASCADE');
$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))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_3B1AF3EB32C8A3DE ON sport_tatarstan_federations (organization_id)');
$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))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E3EDC3B08AFAE46 ON sport_tatarstan_objects (sport_object_id)');
$this->addSql('CREATE TABLE sport_tatarstan_rejected_objects (id SERIAL NOT NULL, url VARCHAR(255) NOT NULL, reason TEXT DEFAULT NULL, PRIMARY KEY(id))');
$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))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_16B3349632C8A3DE ON sport_tatarstan_schools (organization_id)');
$this->addSql('ALTER TABLE sport_tatarstan_federations ADD CONSTRAINT FK_3B1AF3EB32C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_tatarstan_objects ADD CONSTRAINT FK_E3EDC3B08AFAE46 FOREIGN KEY (sport_object_id) REFERENCES sport_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_tatarstan_schools ADD CONSTRAINT FK_16B3349632C8A3DE FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT fk_3ed262c732c8a3de');
$this->addSql('ALTER TABLE sport_tatarstan_imported_objects DROP CONSTRAINT fk_3ed262c78afae46');
$this->addSql('ALTER TABLE sport_tatarstan_imported_federations DROP CONSTRAINT fk_b5f4d8cc32c8a3de');
$this->addSql('DROP TABLE sport_tatarstan_imported_objects');
$this->addSql('DROP TABLE sport_tatarstan_imported_federations');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE sport_tatarstan_imported_federations_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE sport_tatarstan_imported_objects_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$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))');
$this->addSql('CREATE UNIQUE INDEX uniq_3ed262c78afae46 ON sport_tatarstan_imported_objects (sport_object_id)');
$this->addSql('CREATE UNIQUE INDEX uniq_3ed262c732c8a3de ON sport_tatarstan_imported_objects (organization_id)');
$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))');
$this->addSql('CREATE UNIQUE INDEX uniq_b5f4d8cc32c8a3de ON sport_tatarstan_imported_federations (organization_id)');
$this->addSql('ALTER TABLE sport_tatarstan_imported_objects ADD CONSTRAINT fk_3ed262c732c8a3de FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$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');
$this->addSql('ALTER TABLE sport_tatarstan_imported_federations ADD CONSTRAINT fk_b5f4d8cc32c8a3de FOREIGN KEY (organization_id) REFERENCES organization (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE sport_tatarstan_federations DROP CONSTRAINT FK_3B1AF3EB32C8A3DE');
$this->addSql('ALTER TABLE sport_tatarstan_objects DROP CONSTRAINT FK_E3EDC3B08AFAE46');
$this->addSql('ALTER TABLE sport_tatarstan_schools DROP CONSTRAINT FK_16B3349632C8A3DE');
$this->addSql('DROP TABLE sport_tatarstan_federations');
$this->addSql('DROP TABLE sport_tatarstan_objects');
$this->addSql('DROP TABLE sport_tatarstan_rejected_objects');
$this->addSql('DROP TABLE sport_tatarstan_schools');
}
}