<?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 Version20250905084451 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 calltouch_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE calltouch_direct_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE calltouch_map_visit_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE calltouch_order_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE calltouch_session_id_seq CASCADE');
        $this->addSql('DROP SEQUENCE calltouch_webhook_orm_id_seq CASCADE');
        $this->addSql('ALTER TABLE calltouch_session DROP CONSTRAINT fk_6ce17ff773c45666');
        $this->addSql('ALTER TABLE calltouch DROP CONSTRAINT fk_9c123ab5a76ed395');
        $this->addSql('ALTER TABLE calltouch_order DROP CONSTRAINT fk_d09e836573c45666');
        $this->addSql('ALTER TABLE calltouch_direct DROP CONSTRAINT fk_e33e2cff73c45666');
        $this->addSql('ALTER TABLE calltouch_map_visit DROP CONSTRAINT fk_4b22276773c45666');
        $this->addSql('DROP TABLE calltouch_session');
        $this->addSql('DROP TABLE calltouch');
        $this->addSql('DROP TABLE calltouch_order');
        $this->addSql('DROP TABLE calltouch_direct');
        $this->addSql('DROP TABLE calltouch_map_visit');
        $this->addSql('DROP TABLE calltouch_webhook');
    }

    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 calltouch_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE calltouch_direct_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE calltouch_map_visit_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE calltouch_order_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE calltouch_session_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE SEQUENCE calltouch_webhook_orm_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
        $this->addSql('CREATE TABLE calltouch_session (id INT NOT NULL, calltouch_id INT DEFAULT NULL, session_id BIGINT DEFAULT NULL, keywords TEXT DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, source TEXT DEFAULT NULL, medium TEXT DEFAULT NULL, url TEXT DEFAULT NULL, utm_source TEXT DEFAULT NULL, utm_medium TEXT DEFAULT NULL, utm_term TEXT DEFAULT NULL, utm_content TEXT DEFAULT NULL, utm_campaign TEXT DEFAULT NULL, ya_client_id TEXT DEFAULT NULL, gua_client_id TEXT DEFAULT NULL, call_url TEXT DEFAULT NULL, ct_caller_id VARCHAR(255) DEFAULT NULL, status_details VARCHAR(255) DEFAULT NULL, sip_call_id VARCHAR(255) DEFAULT NULL, call_reference_id VARCHAR(255) DEFAULT NULL, ref TEXT DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE UNIQUE INDEX uniq_6ce17ff773c45666 ON calltouch_session (calltouch_id)');
        $this->addSql('CREATE TABLE calltouch (id INT NOT NULL, user_id INT DEFAULT NULL, request_id BIGINT DEFAULT NULL, request_number TEXT DEFAULT NULL, ct_client_id BIGINT DEFAULT NULL, site_id BIGINT NOT NULL, target_request BOOLEAN NOT NULL, status VARCHAR(255) NOT NULL, unique_request BOOLEAN NOT NULL, uniq_target_request BOOLEAN NOT NULL, comments TEXT NOT NULL, date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, subject VARCHAR(255) DEFAULT NULL, manager VARCHAR(255) DEFAULT NULL, date_str VARCHAR(255) NOT NULL, call_id INT DEFAULT NULL, callphase VARCHAR(255) DEFAULT NULL, call_tags TEXT DEFAULT NULL, duration VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX idx_9c123ab5a76ed395 ON calltouch (user_id)');
        $this->addSql('CREATE TABLE calltouch_order (id INT NOT NULL, calltouch_id INT DEFAULT NULL, order_id BIGINT DEFAULT NULL, call_id BIGINT DEFAULT NULL, status VARCHAR(255) DEFAULT NULL, real_sum VARCHAR(255) DEFAULT NULL, offered VARCHAR(255) DEFAULT NULL, sent DATE DEFAULT NULL, sum DOUBLE PRECISION DEFAULT NULL, is_marked BOOLEAN DEFAULT NULL, comments_count VARCHAR(255) DEFAULT NULL, current_amount DOUBLE PRECISION DEFAULT NULL, order_number VARCHAR(255) DEFAULT NULL, order_sum DOUBLE PRECISION DEFAULT NULL, order_status VARCHAR(255) DEFAULT NULL, order_comments VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX idx_d09e836573c45666 ON calltouch_order (calltouch_id)');
        $this->addSql('CREATE TABLE calltouch_direct (id INT NOT NULL, calltouch_id INT DEFAULT NULL, criteria_id BIGINT DEFAULT NULL, campaign_id BIGINT DEFAULT NULL, ad_group_id BIGINT DEFAULT NULL, ad_id BIGINT DEFAULT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE UNIQUE INDEX uniq_e33e2cff73c45666 ON calltouch_direct (calltouch_id)');
        $this->addSql('CREATE TABLE calltouch_map_visit (id INT NOT NULL, calltouch_id INT DEFAULT NULL, utm_source TEXT DEFAULT NULL, session_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, city TEXT DEFAULT NULL, utm_term TEXT DEFAULT NULL, utm_content TEXT DEFAULT NULL, user_agent TEXT DEFAULT NULL, session_id BIGINT DEFAULT NULL, source TEXT DEFAULT NULL, medium TEXT DEFAULT NULL, utm_campaign TEXT DEFAULT NULL, url TEXT DEFAULT NULL, ref TEXT NOT NULL, additional_tags TEXT DEFAULT NULL, utm_medium TEXT DEFAULT NULL, gua_client_id DOUBLE PRECISION DEFAULT NULL, keyword TEXT DEFAULT NULL, session_date_str VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
        $this->addSql('CREATE INDEX idx_4b22276773c45666 ON calltouch_map_visit (calltouch_id)');
        $this->addSql('CREATE TABLE calltouch_webhook (orm_id BIGINT NOT NULL, id BIGINT DEFAULT NULL, leadtype VARCHAR(170) DEFAULT NULL, callphase VARCHAR(170) DEFAULT NULL, changed_fields TEXT DEFAULT NULL, request_id BIGINT DEFAULT NULL, request_number VARCHAR(170) DEFAULT NULL, subject TEXT DEFAULT NULL, ct_caller_id BIGINT DEFAULT NULL, sub_pool_name VARCHAR(170) DEFAULT NULL, redirect_number VARCHAR(170) DEFAULT NULL, duration VARCHAR(170) DEFAULT NULL, waiting_time VARCHAR(170) DEFAULT NULL, calltime VARCHAR(170) DEFAULT NULL, "timestamp" VARCHAR(170) DEFAULT NULL, request_date VARCHAR(170) DEFAULT NULL, status VARCHAR(170) DEFAULT NULL, status_details VARCHAR(170) DEFAULT NULL, unique_str VARCHAR(170) DEFAULT NULL, targetcall VARCHAR(170) DEFAULT NULL, uniqtargetcall VARCHAR(170) DEFAULT NULL, callback VARCHAR(170) DEFAULT NULL, uniquerequest VARCHAR(170) DEFAULT NULL, targetrequest VARCHAR(170) DEFAULT NULL, uniqtargetrequest VARCHAR(170) DEFAULT NULL, worktime VARCHAR(170) DEFAULT NULL, pool VARCHAR(170) DEFAULT NULL, rating VARCHAR(170) DEFAULT NULL, comment TEXT DEFAULT NULL, tags_auto_pr VARCHAR(170) DEFAULT NULL, tags_auto_af VARCHAR(170) DEFAULT NULL, tags_auto_gr VARCHAR(170) DEFAULT NULL, tags_auto_ct VARCHAR(170) DEFAULT NULL, tags_auto_pn VARCHAR(170) DEFAULT NULL, tags_manual VARCHAR(170) DEFAULT NULL, tags_api TEXT DEFAULT NULL, tags_request TEXT DEFAULT NULL, attribution VARCHAR(170) DEFAULT NULL, source VARCHAR(170) DEFAULT NULL, medium VARCHAR(170) DEFAULT NULL, utm_source VARCHAR(170) DEFAULT NULL, utm_medium VARCHAR(170) DEFAULT NULL, utm_campaign VARCHAR(170) DEFAULT NULL, utm_content VARCHAR(170) DEFAULT NULL, utm_term VARCHAR(170) DEFAULT NULL, add_url_params TEXT DEFAULT NULL, gcid BIGINT DEFAULT NULL, ya_client_id BIGINT DEFAULT NULL, session_id BIGINT DEFAULT NULL, ct_client_id BIGINT DEFAULT NULL, ct_global_id BIGINT DEFAULT NULL, hostname VARCHAR(170) DEFAULT NULL, url TEXT DEFAULT NULL, attrs TEXT DEFAULT NULL, call_url TEXT DEFAULT NULL, request_url TEXT DEFAULT NULL, callback_request_id BIGINT DEFAULT NULL, callback_final_attempt VARCHAR(170) DEFAULT NULL, ref TEXT DEFAULT NULL, city VARCHAR(170) DEFAULT NULL, browser VARCHAR(170) DEFAULT NULL, os VARCHAR(170) DEFAULT NULL, device VARCHAR(170) DEFAULT NULL, ip VARCHAR(170) DEFAULT NULL, sip_call_id BIGINT DEFAULT NULL, call_reference_number VARCHAR(170) DEFAULT NULL, reclink TEXT DEFAULT NULL, order_id BIGINT DEFAULT NULL, site_id BIGINT DEFAULT NULL, site_name VARCHAR(170) DEFAULT NULL, user_agent TEXT DEFAULT NULL, sending_timestamp VARCHAR(170) DEFAULT NULL, text TEXT DEFAULT NULL, manager VARCHAR(170) DEFAULT NULL, spam VARCHAR(170) DEFAULT NULL, callback_custom_fields VARCHAR(170) DEFAULT NULL, callback_request_facebook_lead_id BIGINT DEFAULT NULL, PRIMARY KEY(orm_id))');
        $this->addSql('ALTER TABLE calltouch_session ADD CONSTRAINT fk_6ce17ff773c45666 FOREIGN KEY (calltouch_id) REFERENCES calltouch (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE calltouch ADD CONSTRAINT fk_9c123ab5a76ed395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE calltouch_order ADD CONSTRAINT fk_d09e836573c45666 FOREIGN KEY (calltouch_id) REFERENCES calltouch (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE calltouch_direct ADD CONSTRAINT fk_e33e2cff73c45666 FOREIGN KEY (calltouch_id) REFERENCES calltouch (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE calltouch_map_visit ADD CONSTRAINT fk_4b22276773c45666 FOREIGN KEY (calltouch_id) REFERENCES calltouch (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
    }
}
