<?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 Version20221104091837 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 freeswitch.click_to_call_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE freeswitch.click_to_call (id INT NOT NULL, operator_id INT DEFAULT NULL, callcenter_id INT DEFAULT NULL, non_working_time_attachment_id INT DEFAULT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, domain VARCHAR(255) NOT NULL, is_active BOOLEAN DEFAULT true NOT NULL, direction VARCHAR(32) NOT NULL, prospect_work_schedule_id INT DEFAULT NULL, created_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, is_deleted BOOLEAN DEFAULT false NOT NULL, deleted_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6D5572F6989D9B62 ON freeswitch.click_to_call (slug)');
$this->addSql('CREATE INDEX IDX_6D5572F6584598A3 ON freeswitch.click_to_call (operator_id)');
$this->addSql('CREATE INDEX IDX_6D5572F62194D7AD ON freeswitch.click_to_call (callcenter_id)');
$this->addSql('CREATE INDEX IDX_6D5572F6B019F68E ON freeswitch.click_to_call (non_working_time_attachment_id)');
$this->addSql('CREATE INDEX IDX_6D5572F69033212A ON freeswitch.click_to_call (tenant_id)');
$this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F6584598A3 FOREIGN KEY (operator_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F62194D7AD FOREIGN KEY (callcenter_id) REFERENCES freeswitch.callcenter (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F6B019F68E FOREIGN KEY (non_working_time_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F69033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE call.call ADD click_to_call_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811DE5777795 FOREIGN KEY (click_to_call_id) REFERENCES freeswitch.click_to_call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_3FBD811DE5777795 ON call.call (click_to_call_id)');
}
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('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811DE5777795');
$this->addSql('DROP SEQUENCE freeswitch.click_to_call_id_seq CASCADE');
$this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F6584598A3');
$this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F62194D7AD');
$this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F6B019F68E');
$this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F69033212A');
$this->addSql('DROP TABLE freeswitch.click_to_call');
$this->addSql('DROP INDEX IDX_3FBD811DE5777795');
$this->addSql('ALTER TABLE call.call DROP click_to_call_id');
}
}