<?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 Version20220817084538 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 form_quotation_request (id INT AUTO_INCREMENT NOT NULL, adviser_id INT DEFAULT NULL, name LONGTEXT DEFAULT NULL, document VARCHAR(15) DEFAULT NULL, phone VARCHAR(15) DEFAULT NULL, email VARCHAR(255) NOT NULL, spare_parts JSON NOT NULL, utm_source VARCHAR(255) DEFAULT NULL, utm_medium VARCHAR(255) DEFAULT NULL, utm_campaign VARCHAR(255) DEFAULT NULL, utm_content VARCHAR(255) DEFAULT NULL, utm_term VARCHAR(255) DEFAULT NULL, gclid VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, INDEX IDX_6E9766762C63B5D6 (adviser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE form_quotation_services (id INT AUTO_INCREMENT NOT NULL, adviser_id INT DEFAULT NULL, type_person VARCHAR(255) NOT NULL, document_type VARCHAR(255) NOT NULL, document_number VARCHAR(255) NOT NULL, company VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, service VARCHAR(255) NOT NULL, establishment VARCHAR(255) NOT NULL, date VARCHAR(255) NOT NULL, message LONGTEXT DEFAULT NULL, utm_source VARCHAR(255) DEFAULT NULL, utm_medium VARCHAR(255) DEFAULT NULL, utm_campaign VARCHAR(255) DEFAULT NULL, utm_content VARCHAR(255) DEFAULT NULL, utm_term VARCHAR(255) DEFAULT NULL, gclid VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, INDEX IDX_AAB1BB5C2C63B5D6 (adviser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE form_quotation_trucks (id INT AUTO_INCREMENT NOT NULL, type_person VARCHAR(255) NOT NULL, document_type VARCHAR(255) NOT NULL, document_number VARCHAR(255) NOT NULL, company VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, lastname VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, department VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, tonnage VARCHAR(255) NOT NULL, utm_source VARCHAR(255) DEFAULT NULL, utm_medium VARCHAR(255) DEFAULT NULL, utm_campaign VARCHAR(255) DEFAULT NULL, utm_content VARCHAR(255) DEFAULT NULL, utm_term VARCHAR(255) DEFAULT NULL, gclid VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE quotation_request (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, text_1 VARCHAR(255) DEFAULT NULL, text_2 VARCHAR(255) DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE quotation_services (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, text LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE quotation_trucks (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, text LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE request_service (id INT AUTO_INCREMENT NOT NULL, client_id INT DEFAULT NULL, adviser_id INT DEFAULT NULL, service VARCHAR(255) NOT NULL, date VARCHAR(255) NOT NULL, message LONGTEXT DEFAULT NULL, status VARCHAR(255) NOT NULL, notified TINYINT(1) DEFAULT 0 NOT NULL, notification_subject VARCHAR(255) DEFAULT NULL, notification_body LONGTEXT DEFAULT NULL, notification_date DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, INDEX IDX_CBB9E88519EB6921 (client_id), INDEX IDX_CBB9E8852C63B5D6 (adviser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE request_spare_part (id INT AUTO_INCREMENT NOT NULL, client_id INT DEFAULT NULL, adviser_id INT DEFAULT NULL, spare_parts JSON NOT NULL, status VARCHAR(255) NOT NULL, notified TINYINT(1) DEFAULT 0 NOT NULL, notification_subject VARCHAR(255) DEFAULT NULL, notification_body LONGTEXT DEFAULT NULL, notification_date DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, INDEX IDX_AB295A8C19EB6921 (client_id), INDEX IDX_AB295A8C2C63B5D6 (adviser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_client (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, name LONGTEXT DEFAULT NULL, document VARCHAR(15) DEFAULT NULL, phone VARCHAR(15) DEFAULT NULL, type VARCHAR(100) DEFAULT NULL, company_name VARCHAR(255) DEFAULT NULL, company_ruc VARCHAR(255) DEFAULT NULL, next_play_on DATE DEFAULT NULL, password VARCHAR(255) NOT NULL, created_at DATETIME DEFAULT NULL, modified_at DATETIME DEFAULT NULL, created_user INT DEFAULT NULL, modified_user INT DEFAULT NULL, UNIQUE INDEX UNIQ_A2161F68E7927C74 (email), UNIQUE INDEX UNIQ_A2161F68D8698A76 (document), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE form_quotation_request ADD CONSTRAINT FK_6E9766762C63B5D6 FOREIGN KEY (adviser_id) REFERENCES user (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE form_quotation_services ADD CONSTRAINT FK_AAB1BB5C2C63B5D6 FOREIGN KEY (adviser_id) REFERENCES user (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE request_service ADD CONSTRAINT FK_CBB9E88519EB6921 FOREIGN KEY (client_id) REFERENCES user_client (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE request_service ADD CONSTRAINT FK_CBB9E8852C63B5D6 FOREIGN KEY (adviser_id) REFERENCES user (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE request_spare_part ADD CONSTRAINT FK_AB295A8C19EB6921 FOREIGN KEY (client_id) REFERENCES user_client (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE request_spare_part ADD CONSTRAINT FK_AB295A8C2C63B5D6 FOREIGN KEY (adviser_id) REFERENCES user (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE form_quotation_request DROP FOREIGN KEY FK_6E9766762C63B5D6');
$this->addSql('ALTER TABLE form_quotation_services DROP FOREIGN KEY FK_AAB1BB5C2C63B5D6');
$this->addSql('ALTER TABLE request_service DROP FOREIGN KEY FK_CBB9E88519EB6921');
$this->addSql('ALTER TABLE request_service DROP FOREIGN KEY FK_CBB9E8852C63B5D6');
$this->addSql('ALTER TABLE request_spare_part DROP FOREIGN KEY FK_AB295A8C19EB6921');
$this->addSql('ALTER TABLE request_spare_part DROP FOREIGN KEY FK_AB295A8C2C63B5D6');
$this->addSql('DROP TABLE form_quotation_request');
$this->addSql('DROP TABLE form_quotation_services');
$this->addSql('DROP TABLE form_quotation_trucks');
$this->addSql('DROP TABLE quotation_request');
$this->addSql('DROP TABLE quotation_services');
$this->addSql('DROP TABLE quotation_trucks');
$this->addSql('DROP TABLE request_service');
$this->addSql('DROP TABLE request_spare_part');
$this->addSql('DROP TABLE user_client');
}
}