<?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 Version20220518162839 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 customer_address (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, vat_number VARCHAR(15) DEFAULT NULL, tax_code VARCHAR(16) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, zip_code VARCHAR(10) DEFAULT NULL, city VARCHAR(30) DEFAULT NULL, province VARCHAR(30) DEFAULT NULL, region VARCHAR(30) DEFAULT NULL, nation VARCHAR(30) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, pec VARCHAR(255) DEFAULT NULL, sdi_code VARCHAR(15) DEFAULT NULL, INDEX IDX_1193CB3F9395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customer_contact (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, full_name VARCHAR(50) DEFAULT NULL, phone VARCHAR(15) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, details VARCHAR(255) DEFAULT NULL, INDEX IDX_50BF42869395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customer_details (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, created_by VARCHAR(255) NOT NULL, updated_by VARCHAR(255) NOT NULL, expiration DATETIME DEFAULT NULL, additional LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\', legal_name VARCHAR(255) DEFAULT NULL, vat_number VARCHAR(15) DEFAULT NULL, tax_code VARCHAR(16) DEFAULT NULL, UNIQUE INDEX UNIQ_6EFBAF349395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customer_log (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, created DATETIME NOT NULL, created_by VARCHAR(255) NOT NULL, content LONGTEXT NOT NULL, INDEX IDX_C0CC36339395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE customer_address ADD CONSTRAINT FK_1193CB3F9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE customer_contact ADD CONSTRAINT FK_50BF42869395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE customer_details ADD CONSTRAINT FK_6EFBAF349395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE customer_log ADD CONSTRAINT FK_C0CC36339395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE customer ADD app_gaccount VARCHAR(255) NOT NULL, ADD g_token_status SMALLINT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE customer_address');
$this->addSql('DROP TABLE customer_contact');
$this->addSql('DROP TABLE customer_details');
$this->addSql('DROP TABLE customer_log');
$this->addSql('ALTER TABLE customer DROP app_gaccount, DROP g_token_status');
}
}