migrations/Version20221104091837.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 Version20221104091837 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 SEQUENCE freeswitch.click_to_call_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $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))');
  20.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6D5572F6989D9B62 ON freeswitch.click_to_call (slug)');
  21.         $this->addSql('CREATE INDEX IDX_6D5572F6584598A3 ON freeswitch.click_to_call (operator_id)');
  22.         $this->addSql('CREATE INDEX IDX_6D5572F62194D7AD ON freeswitch.click_to_call (callcenter_id)');
  23.         $this->addSql('CREATE INDEX IDX_6D5572F6B019F68E ON freeswitch.click_to_call (non_working_time_attachment_id)');
  24.         $this->addSql('CREATE INDEX IDX_6D5572F69033212A ON freeswitch.click_to_call (tenant_id)');
  25.         $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');
  26.         $this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F62194D7AD FOREIGN KEY (callcenter_id) REFERENCES freeswitch.callcenter (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $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');
  28.         $this->addSql('ALTER TABLE freeswitch.click_to_call ADD CONSTRAINT FK_6D5572F69033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE call.call ADD click_to_call_id INT DEFAULT NULL');
  30.         $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');
  31.         $this->addSql('CREATE INDEX IDX_3FBD811DE5777795 ON call.call (click_to_call_id)');
  32.     }
  33.     public function down(Schema $schema): void
  34.     {
  35.         // this down() migration is auto-generated, please modify it to your needs
  36.         $this->addSql('CREATE SCHEMA public');
  37.         $this->addSql('ALTER TABLE call.call DROP CONSTRAINT FK_3FBD811DE5777795');
  38.         $this->addSql('DROP SEQUENCE freeswitch.click_to_call_id_seq CASCADE');
  39.         $this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F6584598A3');
  40.         $this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F62194D7AD');
  41.         $this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F6B019F68E');
  42.         $this->addSql('ALTER TABLE freeswitch.click_to_call DROP CONSTRAINT FK_6D5572F69033212A');
  43.         $this->addSql('DROP TABLE freeswitch.click_to_call');
  44.         $this->addSql('DROP INDEX IDX_3FBD811DE5777795');
  45.         $this->addSql('ALTER TABLE call.call DROP click_to_call_id');
  46.     }
  47. }