migrations/Version20220808220737.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 Version20220808220737 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.gateway_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE SEQUENCE freeswitch.gateway_variable_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  20.         $this->addSql('CREATE TABLE freeswitch.gateway (id INT NOT NULL, ivr_id INT DEFAULT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, proxy VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, register BOOLEAN DEFAULT \'true\' NOT NULL, caller_id_in_from BOOLEAN DEFAULT \'true\' NOT NULL, realm VARCHAR(255) DEFAULT NULL, from_user VARCHAR(255) DEFAULT NULL, from_domain VARCHAR(255) DEFAULT NULL, extension VARCHAR(255) DEFAULT NULL, outbound_proxy VARCHAR(255) DEFAULT NULL, register_proxy VARCHAR(255) DEFAULT NULL, expire_seconds INT DEFAULT NULL, register_transport VARCHAR(100) DEFAULT \'udp\' NOT NULL, retry_seconds INT DEFAULT NULL, contact_params VARCHAR(255) DEFAULT NULL, ping INT DEFAULT NULL, is_active BOOLEAN DEFAULT \'true\' 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))');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_1E093BD5989D9B62 ON freeswitch.gateway (slug)');
  22.         $this->addSql('CREATE INDEX IDX_1E093BD5B09D9E6B ON freeswitch.gateway (ivr_id)');
  23.         $this->addSql('CREATE INDEX IDX_1E093BD59033212A ON freeswitch.gateway (tenant_id)');
  24.         $this->addSql('CREATE TABLE freeswitch.gateway_variable (id INT NOT NULL, gateway_id INT NOT NULL, tenant_id INT NOT NULL, name VARCHAR(255) NOT NULL, direction VARCHAR(255) NOT NULL, value 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))');
  25.         $this->addSql('CREATE INDEX IDX_C8FEAF88577F8E00 ON freeswitch.gateway_variable (gateway_id)');
  26.         $this->addSql('CREATE INDEX IDX_C8FEAF889033212A ON freeswitch.gateway_variable (tenant_id)');
  27.         $this->addSql('ALTER TABLE freeswitch.gateway ADD CONSTRAINT FK_1E093BD5B09D9E6B FOREIGN KEY (ivr_id) REFERENCES freeswitch.ivr (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE freeswitch.gateway ADD CONSTRAINT FK_1E093BD59033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE freeswitch.gateway_variable ADD CONSTRAINT FK_C8FEAF88577F8E00 FOREIGN KEY (gateway_id) REFERENCES freeswitch.gateway (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  30.         $this->addSql('ALTER TABLE freeswitch.gateway_variable ADD CONSTRAINT FK_C8FEAF889033212A FOREIGN KEY (tenant_id) REFERENCES account.tenant (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  31.         $this->addSql('ALTER TABLE freeswitch.ivr DROP is_active');
  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 freeswitch.gateway_variable DROP CONSTRAINT FK_C8FEAF88577F8E00');
  38.         $this->addSql('DROP SEQUENCE freeswitch.gateway_id_seq CASCADE');
  39.         $this->addSql('DROP SEQUENCE freeswitch.gateway_variable_id_seq CASCADE');
  40.         $this->addSql('DROP TABLE freeswitch.gateway');
  41.         $this->addSql('DROP TABLE freeswitch.gateway_variable');
  42.         $this->addSql('ALTER TABLE freeswitch.ivr ADD is_active BOOLEAN DEFAULT \'false\' NOT NULL');
  43.     }
  44. }