migrations/Version20211015171224.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 Version20211015171224 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 SCHEMA system');
  19.         $this->addSql('CREATE SCHEMA call');
  20.         $this->addSql('CREATE SCHEMA freeswitch');
  21.         $this->addSql('CREATE SCHEMA auth');
  22.         $this->addSql('CREATE SCHEMA account');
  23.         $this->addSql('CREATE SEQUENCE system.attachment_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  24.         $this->addSql('CREATE SEQUENCE call.call_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  25.         $this->addSql('CREATE SEQUENCE call.call_appeal_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  26.         $this->addSql('CREATE SEQUENCE call.call_participant_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  27.         $this->addSql('CREATE SEQUENCE call.call_participant_hold_event_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  28.         $this->addSql('CREATE SEQUENCE call.call_recording_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  29.         $this->addSql('CREATE SEQUENCE freeswitch.callcenter_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  30.         $this->addSql('CREATE SEQUENCE freeswitch.callcenter_agent_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  31.         $this->addSql('CREATE SEQUENCE freeswitch.cdr_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  32.         $this->addSql('CREATE SEQUENCE freeswitch.ivr_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  33.         $this->addSql('CREATE SEQUENCE freeswitch.ivr_action_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  34.         $this->addSql('CREATE SEQUENCE system.offline_reason_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  35.         $this->addSql('CREATE SEQUENCE auth.person_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  36.         $this->addSql('CREATE SEQUENCE account.tenant_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  37.         $this->addSql('CREATE SEQUENCE account.tenant_person_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  38.         $this->addSql('CREATE SEQUENCE account.tenant_person_role_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  39.         $this->addSql('CREATE SEQUENCE system.tenant_person_status_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  40.         $this->addSql('CREATE SEQUENCE auth.tenant_person_token_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  41.         $this->addSql('CREATE TABLE system.attachment (id INT NOT NULL, tenant_person_id INT DEFAULT NULL, tenant_id INT NOT NULL, original_name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, size INT NOT NULL, mime_type VARCHAR(100) 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))');
  42.         $this->addSql('CREATE INDEX IDX_F32044B12837A9A ON system.attachment (tenant_person_id)');
  43.         $this->addSql('CREATE INDEX IDX_F32044B19033212A ON system.attachment (tenant_id)');
  44.         $this->addSql('CREATE TABLE call.call (id INT NOT NULL, from_operator_id INT DEFAULT NULL, to_operator_id INT DEFAULT NULL, ivr_id INT DEFAULT NULL, callback_call_id INT DEFAULT NULL, appeal_type_id INT DEFAULT NULL, tenant_id INT NOT NULL, uuid UUID NOT NULL, direction SMALLINT NOT NULL, status SMALLINT DEFAULT NULL, from_number VARCHAR(100) NOT NULL, to_number VARCHAR(100) NOT NULL, prospect_contact_id INT DEFAULT NULL, started_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, ended_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, answered_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, queue_joined_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, queue_left_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, total_time INT DEFAULT 0 NOT NULL, wait_time INT DEFAULT 0 NOT NULL, talk_time INT DEFAULT 0 NOT NULL, queue_time INT DEFAULT 0 NOT NULL, pre_queue_time INT DEFAULT 0 NOT NULL, hangup_disposition SMALLINT DEFAULT NULL, is_working_time BOOLEAN DEFAULT \'true\' NOT NULL, missed_reason SMALLINT DEFAULT NULL, callback_status SMALLINT DEFAULT NULL, type SMALLINT DEFAULT NULL, prospect_order_id INT DEFAULT NULL, note TEXT 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))');
  45.         $this->addSql('CREATE INDEX IDX_3FBD811DC60AA9C6 ON call.call (from_operator_id)');
  46.         $this->addSql('CREATE INDEX IDX_3FBD811D76D6A6C0 ON call.call (to_operator_id)');
  47.         $this->addSql('CREATE INDEX IDX_3FBD811DB09D9E6B ON call.call (ivr_id)');
  48.         $this->addSql('CREATE INDEX IDX_3FBD811DC5812FD7 ON call.call (callback_call_id)');
  49.         $this->addSql('CREATE INDEX IDX_3FBD811D2F007FEB ON call.call (appeal_type_id)');
  50.         $this->addSql('CREATE INDEX IDX_3FBD811D9033212A ON call.call (tenant_id)');
  51.         $this->addSql('CREATE TABLE call.call_appeal_type (id INT NOT NULL, parent_id INT DEFAULT NULL, root_id INT DEFAULT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, depth INT DEFAULT 1 NOT 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))');
  52.         $this->addSql('CREATE INDEX IDX_D1F7F3E0727ACA70 ON call.call_appeal_type (parent_id)');
  53.         $this->addSql('CREATE INDEX IDX_D1F7F3E079066886 ON call.call_appeal_type (root_id)');
  54.         $this->addSql('CREATE INDEX IDX_D1F7F3E09033212A ON call.call_appeal_type (tenant_id)');
  55.         $this->addSql('CREATE TABLE call.call_participant (id INT NOT NULL, call_id INT NOT NULL, operator_id INT DEFAULT NULL, tenant_id INT NOT NULL, uuid UUID NOT NULL, prospect_contact_id INT DEFAULT NULL, number VARCHAR(100) NOT NULL, is_initiator BOOLEAN NOT NULL, status SMALLINT DEFAULT NULL, missed_reason SMALLINT DEFAULT NULL, started_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, profile_started_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, progressed_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, media_progressed_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, ring_started_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, answered_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, bridged_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, resurrected_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, last_held_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, ended_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, total_time INT DEFAULT 0 NOT NULL, wait_time INT DEFAULT 0 NOT NULL, progress_wait_time INT DEFAULT 0 NOT NULL, media_progress_wait_time INT DEFAULT 0 NOT NULL, ring_time INT DEFAULT 0 NOT NULL, talk_time INT DEFAULT 0 NOT NULL, billing_time INT DEFAULT 0 NOT NULL, leg_billing_time INT DEFAULT 0 NOT NULL, total_hold_time INT DEFAULT 0 NOT NULL, hangup_disposition SMALLINT NOT NULL, hangup_cause VARCHAR(100) NOT NULL, audio_in_quality_rate SMALLINT DEFAULT NULL, audio_out_quality_rate SMALLINT 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))');
  56.         $this->addSql('CREATE INDEX IDX_277AD02850A89B2C ON call.call_participant (call_id)');
  57.         $this->addSql('CREATE INDEX IDX_277AD028584598A3 ON call.call_participant (operator_id)');
  58.         $this->addSql('CREATE INDEX IDX_277AD0289033212A ON call.call_participant (tenant_id)');
  59.         $this->addSql('CREATE TABLE call.call_participant_hold_event (id INT NOT NULL, call_participant_id INT NOT NULL, tenant_id INT NOT NULL, started_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, ended_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, duration 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))');
  60.         $this->addSql('CREATE INDEX IDX_CCB2CBBAF463A42A ON call.call_participant_hold_event (call_participant_id)');
  61.         $this->addSql('CREATE INDEX IDX_CCB2CBBA9033212A ON call.call_participant_hold_event (tenant_id)');
  62.         $this->addSql('CREATE TABLE call.call_recording (id INT NOT NULL, call_id INT NOT NULL, tenant_id INT NOT NULL, original_name VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, size INT NOT NULL, duration INT NOT NULL, path VARCHAR(255) NOT 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))');
  63.         $this->addSql('CREATE UNIQUE INDEX UNIQ_466982D750A89B2C ON call.call_recording (call_id)');
  64.         $this->addSql('CREATE INDEX IDX_466982D79033212A ON call.call_recording (tenant_id)');
  65.         $this->addSql('CREATE TABLE freeswitch.callcenter (id INT NOT NULL, moh_sound_attachment_id INT DEFAULT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, strategy VARCHAR(100) NOT NULL, wrap_up_time INT NOT NULL, leg_timeout INT NOT NULL, no_answer_delay_time INT NOT NULL, reject_delay_time INT NOT NULL, ring_progressively_delay_time 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))');
  66.         $this->addSql('CREATE UNIQUE INDEX UNIQ_57307069989D9B62 ON freeswitch.callcenter (slug)');
  67.         $this->addSql('CREATE INDEX IDX_573070696E106712 ON freeswitch.callcenter (moh_sound_attachment_id)');
  68.         $this->addSql('CREATE INDEX IDX_573070699033212A ON freeswitch.callcenter (tenant_id)');
  69.         $this->addSql('CREATE TABLE freeswitch.callcenter_agent (id INT NOT NULL, callcenter_id INT NOT NULL, agent_id INT NOT NULL, tenant_id INT NOT 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))');
  70.         $this->addSql('CREATE INDEX IDX_E3420EC82194D7AD ON freeswitch.callcenter_agent (callcenter_id)');
  71.         $this->addSql('CREATE INDEX IDX_E3420EC83414710B ON freeswitch.callcenter_agent (agent_id)');
  72.         $this->addSql('CREATE INDEX IDX_E3420EC89033212A ON freeswitch.callcenter_agent (tenant_id)');
  73.         $this->addSql('CREATE TABLE freeswitch.cdr (id INT NOT NULL, call_id INT NOT NULL, tenant_id INT NOT NULL, json JSON 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))');
  74.         $this->addSql('CREATE INDEX IDX_2285D86550A89B2C ON freeswitch.cdr (call_id)');
  75.         $this->addSql('CREATE INDEX IDX_2285D8659033212A ON freeswitch.cdr (tenant_id)');
  76.         $this->addSql('CREATE TABLE freeswitch.ivr (id INT NOT NULL, greet_long_attachment_id INT NOT NULL, greet_short_attachment_id INT DEFAULT NULL, invalid_sound_attachment_id INT DEFAULT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, timeout INT NOT NULL, inter_digit_timeout INT NOT NULL, digit_length INT NOT NULL, max_failures INT NOT NULL, is_active BOOLEAN DEFAULT \'false\' NOT 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))');
  77.         $this->addSql('CREATE UNIQUE INDEX UNIQ_57E62D60989D9B62 ON freeswitch.ivr (slug)');
  78.         $this->addSql('CREATE INDEX IDX_57E62D602E96DAE6 ON freeswitch.ivr (greet_long_attachment_id)');
  79.         $this->addSql('CREATE INDEX IDX_57E62D6064075E77 ON freeswitch.ivr (greet_short_attachment_id)');
  80.         $this->addSql('CREATE INDEX IDX_57E62D602A1F4492 ON freeswitch.ivr (invalid_sound_attachment_id)');
  81.         $this->addSql('CREATE INDEX IDX_57E62D609033212A ON freeswitch.ivr (tenant_id)');
  82.         $this->addSql('CREATE TABLE freeswitch.ivr_action (id INT NOT NULL, operator_id INT DEFAULT NULL, callcenter_id INT DEFAULT NULL, ivr_id INT NOT NULL, tenant_id INT NOT NULL, digit VARCHAR(32) NOT NULL, action VARCHAR(32) NOT 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))');
  83.         $this->addSql('CREATE INDEX IDX_7F353478584598A3 ON freeswitch.ivr_action (operator_id)');
  84.         $this->addSql('CREATE INDEX IDX_7F3534782194D7AD ON freeswitch.ivr_action (callcenter_id)');
  85.         $this->addSql('CREATE INDEX IDX_7F353478B09D9E6B ON freeswitch.ivr_action (ivr_id)');
  86.         $this->addSql('CREATE INDEX IDX_7F3534789033212A ON freeswitch.ivr_action (tenant_id)');
  87.         $this->addSql('CREATE TABLE system.offline_reason (id INT NOT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT 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))');
  88.         $this->addSql('CREATE INDEX IDX_794625EE9033212A ON system.offline_reason (tenant_id)');
  89.         $this->addSql('CREATE TABLE auth.person (id INT NOT NULL, uuid VARCHAR(180) NOT NULL, roles JSON NOT NULL, prospect_person_id INT NOT 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))');
  90.         $this->addSql('CREATE UNIQUE INDEX UNIQ_5E60AD0BD17F50A6 ON auth.person (uuid)');
  91.         $this->addSql('CREATE TABLE account.tenant (id INT NOT NULL, non_working_time_attachment_id INT DEFAULT NULL, prospect_tenant_id INT NOT NULL, subdomain VARCHAR(100) 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))');
  92.         $this->addSql('CREATE INDEX IDX_2372D18EB019F68E ON account.tenant (non_working_time_attachment_id)');
  93.         $this->addSql('CREATE TABLE account.tenant_person (id INT NOT NULL, tenant_id INT NOT NULL, person_id INT DEFAULT NULL, prospect_tenant_person_id INT NOT NULL, number VARCHAR(32) NOT NULL, cidr VARCHAR(64) DEFAULT NULL, password VARCHAR(64) NOT 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))');
  94.         $this->addSql('CREATE INDEX IDX_FD31DBAF9033212A ON account.tenant_person (tenant_id)');
  95.         $this->addSql('CREATE INDEX IDX_FD31DBAF217BBB47 ON account.tenant_person (person_id)');
  96.         $this->addSql('CREATE TABLE account.tenant_person_role (id INT NOT NULL, tenant_person_id INT NOT NULL, tenant_id INT NOT NULL, role SMALLINT NOT 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))');
  97.         $this->addSql('CREATE INDEX IDX_8DD5DCF92837A9A ON account.tenant_person_role (tenant_person_id)');
  98.         $this->addSql('CREATE INDEX IDX_8DD5DCF99033212A ON account.tenant_person_role (tenant_id)');
  99.         $this->addSql('CREATE TABLE system.tenant_person_status (id INT NOT NULL, offline_reason_id INT DEFAULT NULL, tenant_person_id INT NOT NULL, call_id INT DEFAULT NULL, tenant_id INT NOT NULL, status SMALLINT NOT NULL, started_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, ended_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, is_deleted BOOLEAN DEFAULT \'false\' NOT NULL, deleted_at TIMESTAMP(6) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
  100.         $this->addSql('CREATE INDEX IDX_A81AD17E4E9F7733 ON system.tenant_person_status (offline_reason_id)');
  101.         $this->addSql('CREATE INDEX IDX_A81AD17E2837A9A ON system.tenant_person_status (tenant_person_id)');
  102.         $this->addSql('CREATE INDEX IDX_A81AD17E50A89B2C ON system.tenant_person_status (call_id)');
  103.         $this->addSql('CREATE INDEX IDX_A81AD17E9033212A ON system.tenant_person_status (tenant_id)');
  104.         $this->addSql('CREATE TABLE auth.tenant_person_token (id INT NOT NULL, tenant_person_id INT NOT NULL, token VARCHAR(255) NOT NULL, expired_at TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL, ip_addr VARCHAR(255) DEFAULT NULL, agent_string VARCHAR(255) DEFAULT NULL, agent_type VARCHAR(255) DEFAULT NULL, agent_name VARCHAR(255) DEFAULT NULL, agent_short_name VARCHAR(255) DEFAULT NULL, agent_version VARCHAR(255) DEFAULT NULL, agent_engine VARCHAR(255) DEFAULT NULL, agent_engine_version VARCHAR(255) DEFAULT NULL, agent_os_name VARCHAR(255) DEFAULT NULL, agent_os_short_name VARCHAR(255) DEFAULT NULL, agent_os_version VARCHAR(255) DEFAULT NULL, agent_os_platform VARCHAR(255) DEFAULT NULL, device_name VARCHAR(255) DEFAULT NULL, device_brand VARCHAR(255) DEFAULT NULL, device_model VARCHAR(255) 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))');
  105.         $this->addSql('CREATE INDEX IDX_581B2CEC2837A9A ON auth.tenant_person_token (tenant_person_id)');
  106.         $this->addSql('ALTER TABLE system.attachment ADD CONSTRAINT FK_F32044B12837A9A FOREIGN KEY (tenant_person_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  107.         $this->addSql('ALTER TABLE system.attachment ADD CONSTRAINT FK_F32044B19033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  108.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811DC60AA9C6 FOREIGN KEY (from_operator_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  109.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811D76D6A6C0 FOREIGN KEY (to_operator_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  110.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811DB09D9E6B FOREIGN KEY (ivr_id) REFERENCES freeswitch.ivr (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  111.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811DC5812FD7 FOREIGN KEY (callback_call_id) REFERENCES call.call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  112.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811D2F007FEB FOREIGN KEY (appeal_type_id) REFERENCES call.call_appeal_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  113.         $this->addSql('ALTER TABLE call.call ADD CONSTRAINT FK_3FBD811D9033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  114.         $this->addSql('ALTER TABLE call.call_appeal_type ADD CONSTRAINT FK_D1F7F3E0727ACA70 FOREIGN KEY (parent_id) REFERENCES call.call_appeal_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  115.         $this->addSql('ALTER TABLE call.call_appeal_type ADD CONSTRAINT FK_D1F7F3E079066886 FOREIGN KEY (root_id) REFERENCES call.call_appeal_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  116.         $this->addSql('ALTER TABLE call.call_appeal_type ADD CONSTRAINT FK_D1F7F3E09033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  117.         $this->addSql('ALTER TABLE call.call_participant ADD CONSTRAINT FK_277AD02850A89B2C FOREIGN KEY (call_id) REFERENCES call.call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  118.         $this->addSql('ALTER TABLE call.call_participant ADD CONSTRAINT FK_277AD028584598A3 FOREIGN KEY (operator_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  119.         $this->addSql('ALTER TABLE call.call_participant ADD CONSTRAINT FK_277AD0289033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  120.         $this->addSql('ALTER TABLE call.call_participant_hold_event ADD CONSTRAINT FK_CCB2CBBAF463A42A FOREIGN KEY (call_participant_id) REFERENCES call.call_participant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  121.         $this->addSql('ALTER TABLE call.call_participant_hold_event ADD CONSTRAINT FK_CCB2CBBA9033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  122.         $this->addSql('ALTER TABLE call.call_recording ADD CONSTRAINT FK_466982D750A89B2C FOREIGN KEY (call_id) REFERENCES call.call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  123.         $this->addSql('ALTER TABLE call.call_recording ADD CONSTRAINT FK_466982D79033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  124.         $this->addSql('ALTER TABLE freeswitch.callcenter ADD CONSTRAINT FK_573070696E106712 FOREIGN KEY (moh_sound_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  125.         $this->addSql('ALTER TABLE freeswitch.callcenter ADD CONSTRAINT FK_573070699033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  126.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent ADD CONSTRAINT FK_E3420EC82194D7AD FOREIGN KEY (callcenter_id) REFERENCES freeswitch.callcenter (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  127.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent ADD CONSTRAINT FK_E3420EC83414710B FOREIGN KEY (agent_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  128.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent ADD CONSTRAINT FK_E3420EC89033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  129.         $this->addSql('ALTER TABLE freeswitch.cdr ADD CONSTRAINT FK_2285D86550A89B2C FOREIGN KEY (call_id) REFERENCES call.call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  130.         $this->addSql('ALTER TABLE freeswitch.cdr ADD CONSTRAINT FK_2285D8659033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  131.         $this->addSql('ALTER TABLE freeswitch.ivr ADD CONSTRAINT FK_57E62D602E96DAE6 FOREIGN KEY (greet_long_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  132.         $this->addSql('ALTER TABLE freeswitch.ivr ADD CONSTRAINT FK_57E62D6064075E77 FOREIGN KEY (greet_short_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  133.         $this->addSql('ALTER TABLE freeswitch.ivr ADD CONSTRAINT FK_57E62D602A1F4492 FOREIGN KEY (invalid_sound_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  134.         $this->addSql('ALTER TABLE freeswitch.ivr ADD CONSTRAINT FK_57E62D609033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  135.         $this->addSql('ALTER TABLE freeswitch.ivr_action ADD CONSTRAINT FK_7F353478584598A3 FOREIGN KEY (operator_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  136.         $this->addSql('ALTER TABLE freeswitch.ivr_action ADD CONSTRAINT FK_7F3534782194D7AD FOREIGN KEY (callcenter_id) REFERENCES freeswitch.callcenter (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  137.         $this->addSql('ALTER TABLE freeswitch.ivr_action ADD CONSTRAINT FK_7F353478B09D9E6B FOREIGN KEY (ivr_id) REFERENCES freeswitch.ivr (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  138.         $this->addSql('ALTER TABLE freeswitch.ivr_action ADD CONSTRAINT FK_7F3534789033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  139.         $this->addSql('ALTER TABLE system.offline_reason ADD CONSTRAINT FK_794625EE9033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  140.         $this->addSql('ALTER TABLE account.tenant ADD CONSTRAINT FK_2372D18EB019F68E FOREIGN KEY (non_working_time_attachment_id) REFERENCES system.attachment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  141.         $this->addSql('ALTER TABLE account.tenant_person ADD CONSTRAINT FK_FD31DBAF9033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  142.         $this->addSql('ALTER TABLE account.tenant_person ADD CONSTRAINT FK_FD31DBAF217BBB47 FOREIGN KEY (person_id) REFERENCES auth.person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  143.         $this->addSql('ALTER TABLE account.tenant_person_role ADD CONSTRAINT FK_8DD5DCF92837A9A FOREIGN KEY (tenant_person_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  144.         $this->addSql('ALTER TABLE account.tenant_person_role ADD CONSTRAINT FK_8DD5DCF99033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  145.         $this->addSql('ALTER TABLE system.tenant_person_status ADD CONSTRAINT FK_A81AD17E4E9F7733 FOREIGN KEY (offline_reason_id) REFERENCES system.offline_reason (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  146.         $this->addSql('ALTER TABLE system.tenant_person_status ADD CONSTRAINT FK_A81AD17E2837A9A FOREIGN KEY (tenant_person_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  147.         $this->addSql('ALTER TABLE system.tenant_person_status ADD CONSTRAINT FK_A81AD17E50A89B2C FOREIGN KEY (call_id) REFERENCES call.call (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  148.         $this->addSql('ALTER TABLE system.tenant_person_status ADD CONSTRAINT FK_A81AD17E9033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  149.         $this->addSql('ALTER TABLE auth.tenant_person_token ADD CONSTRAINT FK_581B2CEC2837A9A FOREIGN KEY (tenant_person_id) REFERENCES account.tenant_person (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  150.     }
  151.     public function down(Schema $schema): void
  152.     {
  153.         // this down() migration is auto-generated, please modify it to your needs
  154.         $this->addSql('CREATE SCHEMA public');
  155.         $this->addSql('ALTER TABLE freeswitch.callcenter DROP CONSTRAINT FK_573070696E106712');
  156.         $this->addSql('ALTER TABLE freeswitch.ivr DROP CONSTRAINT FK_57E62D602E96DAE6');
  157.         $this->addSql('ALTER TABLE freeswitch.ivr DROP CONSTRAINT FK_57E62D6064075E77');
  158.         $this->addSql('ALTER TABLE freeswitch.ivr DROP CONSTRAINT FK_57E62D602A1F4492');
  159.         $this->addSql('ALTER TABLE account.tenant DROP CONSTRAINT FK_2372D18EB019F68E');
  160.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811DC5812FD7');
  161.         $this->addSql('ALTER TABLE call.call_participant DROP CONSTRAINT FK_277AD02850A89B2C');
  162.         $this->addSql('ALTER TABLE call.call_recording DROP CONSTRAINT FK_466982D750A89B2C');
  163.         $this->addSql('ALTER TABLE freeswitch.cdr DROP CONSTRAINT FK_2285D86550A89B2C');
  164.         $this->addSql('ALTER TABLE system.tenant_person_status DROP CONSTRAINT FK_A81AD17E50A89B2C');
  165.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811D2F007FEB');
  166.         $this->addSql('ALTER TABLE call.call_appeal_type DROP CONSTRAINT FK_D1F7F3E0727ACA70');
  167.         $this->addSql('ALTER TABLE call.call_appeal_type DROP CONSTRAINT FK_D1F7F3E079066886');
  168.         $this->addSql('ALTER TABLE call.call_participant_hold_event DROP CONSTRAINT FK_CCB2CBBAF463A42A');
  169.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent DROP CONSTRAINT FK_E3420EC82194D7AD');
  170.         $this->addSql('ALTER TABLE freeswitch.ivr_action DROP CONSTRAINT FK_7F3534782194D7AD');
  171.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811DB09D9E6B');
  172.         $this->addSql('ALTER TABLE freeswitch.ivr_action DROP CONSTRAINT FK_7F353478B09D9E6B');
  173.         $this->addSql('ALTER TABLE system.tenant_person_status DROP CONSTRAINT FK_A81AD17E4E9F7733');
  174.         $this->addSql('ALTER TABLE account.tenant_person DROP CONSTRAINT FK_FD31DBAF217BBB47');
  175.         $this->addSql('ALTER TABLE system.attachment DROP CONSTRAINT FK_F32044B19033212A');
  176.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811D9033212A');
  177.         $this->addSql('ALTER TABLE call.call_appeal_type DROP CONSTRAINT FK_D1F7F3E09033212A');
  178.         $this->addSql('ALTER TABLE call.call_participant DROP CONSTRAINT FK_277AD0289033212A');
  179.         $this->addSql('ALTER TABLE call.call_participant_hold_event DROP CONSTRAINT FK_CCB2CBBA9033212A');
  180.         $this->addSql('ALTER TABLE call.call_recording DROP CONSTRAINT FK_466982D79033212A');
  181.         $this->addSql('ALTER TABLE freeswitch.callcenter DROP CONSTRAINT FK_573070699033212A');
  182.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent DROP CONSTRAINT FK_E3420EC89033212A');
  183.         $this->addSql('ALTER TABLE freeswitch.cdr DROP CONSTRAINT FK_2285D8659033212A');
  184.         $this->addSql('ALTER TABLE freeswitch.ivr DROP CONSTRAINT FK_57E62D609033212A');
  185.         $this->addSql('ALTER TABLE freeswitch.ivr_action DROP CONSTRAINT FK_7F3534789033212A');
  186.         $this->addSql('ALTER TABLE system.offline_reason DROP CONSTRAINT FK_794625EE9033212A');
  187.         $this->addSql('ALTER TABLE account.tenant_person DROP CONSTRAINT FK_FD31DBAF9033212A');
  188.         $this->addSql('ALTER TABLE account.tenant_person_role DROP CONSTRAINT FK_8DD5DCF99033212A');
  189.         $this->addSql('ALTER TABLE system.tenant_person_status DROP CONSTRAINT FK_A81AD17E9033212A');
  190.         $this->addSql('ALTER TABLE system.attachment DROP CONSTRAINT FK_F32044B12837A9A');
  191.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811DC60AA9C6');
  192.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811D76D6A6C0');
  193.         $this->addSql('ALTER TABLE call.call_participant DROP CONSTRAINT FK_277AD028584598A3');
  194.         $this->addSql('ALTER TABLE freeswitch.callcenter_agent DROP CONSTRAINT FK_E3420EC83414710B');
  195.         $this->addSql('ALTER TABLE freeswitch.ivr_action DROP CONSTRAINT FK_7F353478584598A3');
  196.         $this->addSql('ALTER TABLE account.tenant_person_role DROP CONSTRAINT FK_8DD5DCF92837A9A');
  197.         $this->addSql('ALTER TABLE system.tenant_person_status DROP CONSTRAINT FK_A81AD17E2837A9A');
  198.         $this->addSql('ALTER TABLE auth.tenant_person_token DROP CONSTRAINT FK_581B2CEC2837A9A');
  199.         $this->addSql('DROP SEQUENCE system.attachment_id_seq CASCADE');
  200.         $this->addSql('DROP SEQUENCE call.call_id_seq CASCADE');
  201.         $this->addSql('DROP SEQUENCE call.call_appeal_type_id_seq CASCADE');
  202.         $this->addSql('DROP SEQUENCE call.call_participant_id_seq CASCADE');
  203.         $this->addSql('DROP SEQUENCE call.call_participant_hold_event_id_seq CASCADE');
  204.         $this->addSql('DROP SEQUENCE call.call_recording_id_seq CASCADE');
  205.         $this->addSql('DROP SEQUENCE freeswitch.callcenter_id_seq CASCADE');
  206.         $this->addSql('DROP SEQUENCE freeswitch.callcenter_agent_id_seq CASCADE');
  207.         $this->addSql('DROP SEQUENCE freeswitch.cdr_id_seq CASCADE');
  208.         $this->addSql('DROP SEQUENCE freeswitch.ivr_id_seq CASCADE');
  209.         $this->addSql('DROP SEQUENCE freeswitch.ivr_action_id_seq CASCADE');
  210.         $this->addSql('DROP SEQUENCE system.offline_reason_id_seq CASCADE');
  211.         $this->addSql('DROP SEQUENCE auth.person_id_seq CASCADE');
  212.         $this->addSql('DROP SEQUENCE account.tenant_id_seq CASCADE');
  213.         $this->addSql('DROP SEQUENCE account.tenant_person_id_seq CASCADE');
  214.         $this->addSql('DROP SEQUENCE account.tenant_person_role_id_seq CASCADE');
  215.         $this->addSql('DROP SEQUENCE system.tenant_person_status_id_seq CASCADE');
  216.         $this->addSql('DROP SEQUENCE auth.tenant_person_token_id_seq CASCADE');
  217.         $this->addSql('DROP TABLE system.attachment');
  218.         $this->addSql('DROP TABLE call.call');
  219.         $this->addSql('DROP TABLE call.call_appeal_type');
  220.         $this->addSql('DROP TABLE call.call_participant');
  221.         $this->addSql('DROP TABLE call.call_participant_hold_event');
  222.         $this->addSql('DROP TABLE call.call_recording');
  223.         $this->addSql('DROP TABLE freeswitch.callcenter');
  224.         $this->addSql('DROP TABLE freeswitch.callcenter_agent');
  225.         $this->addSql('DROP TABLE freeswitch.cdr');
  226.         $this->addSql('DROP TABLE freeswitch.ivr');
  227.         $this->addSql('DROP TABLE freeswitch.ivr_action');
  228.         $this->addSql('DROP TABLE system.offline_reason');
  229.         $this->addSql('DROP TABLE auth.person');
  230.         $this->addSql('DROP TABLE account.tenant');
  231.         $this->addSql('DROP TABLE account.tenant_person');
  232.         $this->addSql('DROP TABLE account.tenant_person_role');
  233.         $this->addSql('DROP TABLE system.tenant_person_status');
  234.         $this->addSql('DROP TABLE auth.tenant_person_token');
  235.     }
  236. }