<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220328085709 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add country phone codes table';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE country_phone_code (id INT UNSIGNED AUTO_INCREMENT NOT NULL, country_id INT UNSIGNED DEFAULT NULL, code INT UNSIGNED NOT NULL, INDEX IDX_D916E0D7F92F3E70 (country_id), INDEX code (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE country_phone_code ADD CONSTRAINT FK_D916E0D7F92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE country_phone_code');
}
}