<?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 Version20220211180535 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 relacion_zonas (id INT AUTO_INCREMENT NOT NULL, id_zona_id INT NOT NULL, id_estado_id INT NOT NULL, id_municipio_id INT NOT NULL, id_codigopostal_id INT NOT NULL, INDEX IDX_B76A3B63CED3018C (id_zona_id), INDEX IDX_B76A3B631F6FF82C (id_estado_id), INDEX IDX_B76A3B637B7D6E92 (id_municipio_id), INDEX IDX_B76A3B636DCC10FA (id_codigopostal_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE zona (id INT AUTO_INCREMENT NOT NULL, nombre VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE relacion_zonas ADD CONSTRAINT FK_B76A3B63CED3018C FOREIGN KEY (id_zona_id) REFERENCES zona (id)');
$this->addSql('ALTER TABLE relacion_zonas ADD CONSTRAINT FK_B76A3B631F6FF82C FOREIGN KEY (id_estado_id) REFERENCES estado (id)');
$this->addSql('ALTER TABLE relacion_zonas ADD CONSTRAINT FK_B76A3B637B7D6E92 FOREIGN KEY (id_municipio_id) REFERENCES municipio (id)');
$this->addSql('ALTER TABLE relacion_zonas ADD CONSTRAINT FK_B76A3B636DCC10FA FOREIGN KEY (id_codigopostal_id) REFERENCES codigo_postal (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE relacion_zonas DROP FOREIGN KEY FK_B76A3B63CED3018C');
$this->addSql('DROP TABLE relacion_zonas');
$this->addSql('DROP TABLE zona');
}
}