<?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 VersionAfipServicio 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('ALTER TABLE afipempresa_afipservicio DROP FOREIGN KEY FK_E6C7748994326796');
$this->addSql('SET FOREIGN_KEY_CHECKS =0');
$this->addSql('ALTER TABLE documentacion_soporte DROP FOREIGN KEY FK_F8FA11DDDBBAB5D5');
$this->addSql('ALTER TABLE soporte DROP FOREIGN KEY FK_2273AC6727ACA70');
$this->addSql('DROP TABLE afipempresa');
$this->addSql('CREATE TABLE afip_empresa (id INT AUTO_INCREMENT NOT NULL, razonsocial VARCHAR(255) DEFAULT NULL, cuitempresa VARCHAR(13) DEFAULT NULL, created_at DATETIME DEFAULT NULL, created_by VARCHAR(10) DEFAULT NULL,activa TINYINT(1) NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE afipserviciometodo RENAME TO afip_servicio_metodo');
$this->addSql('ALTER TABLE afipservicio RENAME TO afip_servicio');
$this->addSql('ALTER TABLE afip_servicio_metodo CHANGE fkafipservicio fk_afip_servicio INT DEFAULT NULL');
$this->addSql('ALTER TABLE afip_servicio_metodo ADD CONSTRAINT FK_23844A5EA1AB77B2 FOREIGN KEY (fk_afip_servicio) REFERENCES afip_servicio (id)');
$this->addSql('CREATE INDEX IDX_23844A5EA1AB77B2 ON afip_servicio_metodo (fk_afip_servicio)');
$this->addSql('ALTER TABLE afipticketacceso RENAME TO afip_ticket_acceso');
$this->addSql('CREATE TABLE afip_empresa_certificado (id INT AUTO_INCREMENT NOT NULL, fk_empresa INT DEFAULT NULL, fk_servicio INT DEFAULT NULL, certificado LONGTEXT DEFAULT NULL, certificado_crt LONGTEXT DEFAULT NULL, privada LONGTEXT DEFAULT NULL, desde DATETIME DEFAULT NULL, hasta DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, estado TINYINT(1) DEFAULT NULL, created_by VARCHAR(10) DEFAULT NULL, INDEX IDX_9AF84D8448F8677C (fk_empresa), INDEX IDX_9AF84D84F9AEB1F4 (fk_servicio), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE afip_empresa_certificado ADD CONSTRAINT FK_9AF84D8448F8677C FOREIGN KEY (fk_empresa) REFERENCES afip_empresa (id)');
$this->addSql('ALTER TABLE afip_empresa_certificado ADD CONSTRAINT FK_9AF84D84F9AEB1F4 FOREIGN KEY (fk_servicio) REFERENCES afip_servicio (id)');
$this->addSql('CREATE TABLE afip_servicio_afip_empresa (afip_servicio_id INT NOT NULL, afip_empresa_id INT NOT NULL, INDEX IDX_70160B68D78B1DC9 (afip_servicio_id), INDEX IDX_70160B68AFF75034 (afip_empresa_id), PRIMARY KEY(afip_servicio_id, afip_empresa_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE afip_servicio_afip_empresa ADD CONSTRAINT FK_70160B68D78B1DC9 FOREIGN KEY (afip_servicio_id) REFERENCES afip_servicio (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE afip_servicio_afip_empresa ADD CONSTRAINT FK_70160B68AFF75034 FOREIGN KEY (afip_empresa_id) REFERENCES afip_empresa (id) ON DELETE CASCADE');
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('INSERT INTO afip_empresa (razonsocial, cuitempresa, created_at, created_by, activa) VALUES ("Veritas SRL", "30714578169", null, null, null)');
$this->addSql('INSERT INTO afip_empresa (razonsocial, cuitempresa, created_at, created_by, activa) VALUES ("Pablo Pedernera", "20225422835", null, null, 1)');
$this->addSql('INSERT INTO afip_servicio_afip_empresa (afip_servicio_id, afip_empresa_id) VALUES (1, 1)');
$this->addSql('INSERT INTO afip_servicio_afip_empresa (afip_servicio_id, afip_empresa_id) VALUES (1, 2)');
$this->addSql('INSERT INTO afip_empresa_certificado (fk_empresa, fk_servicio, certificado, certificado_crt, privada, desde, hasta, created_at, estado, created_by) VALUES (2, 1, \'20220422201759-afip\', \'20220422201759certificado.crt\', \'20220422201759-privada\', \'2022-04-22 20:17:59\', \'2023-04-22 20:17:59\', \'2022-04-22 20:17:59\', 1, null)');
$this->addSql('SET FOREIGN_KEY_CHECKS =1');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}