<?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 Version20240306100611 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 TABLE customers__customers (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, created_at DATETIME NOT NULL, phone VARCHAR(255) NOT NULL, first_name VARCHAR(255) DEFAULT NULL, sure_name VARCHAR(255) DEFAULT NULL, father_name VARCHAR(255) DEFAULT NULL, farpost_login VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, mango_contact_id VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_52F4A235444F97DD (phone), UNIQUE INDEX UNIQ_52F4A235A76ED395 (user_id), INDEX phone_idx (phone), INDEX email_idx (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE managers (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, created_at DATETIME NOT NULL, visible TINYINT(1) DEFAULT 1 NOT NULL, first_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, father_name VARCHAR(255) DEFAULT NULL, mango_extension_number VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_A949E0063B595F58 (mango_extension_number), UNIQUE INDEX UNIQ_A949E006A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mango__calls (id INT AUTO_INCREMENT NOT NULL, manager_id INT DEFAULT NULL, customer_id INT DEFAULT NULL, created_at DATETIME NOT NULL, phone VARCHAR(255) NOT NULL, sip_id VARCHAR(255) NOT NULL, recording_id VARCHAR(255) DEFAULT NULL, status VARCHAR(255) DEFAULT NULL, duration INT NOT NULL, direction VARCHAR(255) NOT NULL, missed_status VARCHAR(255) DEFAULT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_965100265A69774E (sip_id), INDEX IDX_96510026783E3463 (manager_id), INDEX IDX_965100269395C3F3 (customer_id), INDEX IDX_965100268B8E8428 (created_at), INDEX IDX_96510026444F97DD (phone), INDEX IDX_965100267B00651C (status), INDEX IDX_965100263E4AD1B3 (direction), INDEX IDX_96510026D4E49719 (missed_status), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE customers__customers ADD CONSTRAINT FK_52F4A235A76ED395 FOREIGN KEY (user_id) REFERENCES users__users (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE managers ADD CONSTRAINT FK_A949E006A76ED395 FOREIGN KEY (user_id) REFERENCES users__users (id)');
$this->addSql('ALTER TABLE mango__calls ADD CONSTRAINT FK_96510026783E3463 FOREIGN KEY (manager_id) REFERENCES managers (id)');
$this->addSql('ALTER TABLE mango__calls ADD CONSTRAINT FK_965100269395C3F3 FOREIGN KEY (customer_id) REFERENCES customers__customers (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customers__customers DROP FOREIGN KEY FK_52F4A235A76ED395');
$this->addSql('ALTER TABLE managers DROP FOREIGN KEY FK_A949E006A76ED395');
$this->addSql('ALTER TABLE mango__calls DROP FOREIGN KEY FK_96510026783E3463');
$this->addSql('ALTER TABLE mango__calls DROP FOREIGN KEY FK_965100269395C3F3');
$this->addSql('DROP TABLE customers__customers');
$this->addSql('DROP TABLE managers');
$this->addSql('DROP TABLE mango__calls');
}
}