<?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 Version20200428024536 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE std_favorite_pages_users (page_id INT UNSIGNED NOT NULL COMMENT \'Page unique identifier\', user_id INT UNSIGNED NOT NULL COMMENT \'Unique identifier\', sequence INT DEFAULT NULL, INDEX IDX_8268EAF7C4663E4 (page_id), INDEX IDX_8268EAF7A76ED395 (user_id), PRIMARY KEY(page_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE std_favorite_pages_users ADD CONSTRAINT FK_8268EAF7C4663E4 FOREIGN KEY (page_id) REFERENCES std_pages (id)');
$this->addSql('ALTER TABLE std_favorite_pages_users ADD CONSTRAINT FK_8268EAF7A76ED395 FOREIGN KEY (user_id) REFERENCES std_users (id)');
$this->addSql('DROP TABLE std_favorites_pages_users');
$this->addSql('ALTER TABLE std_languages CHANGE language_code language_code VARCHAR(2) NOT NULL COMMENT \'ISO 639 Language code\'');
$this->addSql('ALTER TABLE std_config CHANGE machine_name machine_name VARCHAR(50) NOT NULL COMMENT \'Unique code used in the programming to identify the config variable\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE std_favorites_pages_users (std_pages_id INT UNSIGNED NOT NULL COMMENT \'Page unique identifier\', std_users_id INT UNSIGNED NOT NULL COMMENT \'Unique identifier\', INDEX IDX_D91A015036259CF9 (std_pages_id), INDEX IDX_D91A0150118CF5E3 (std_users_id), PRIMARY KEY(std_pages_id, std_users_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE std_favorites_pages_users ADD CONSTRAINT FK_D91A0150118CF5E3 FOREIGN KEY (std_users_id) REFERENCES std_users (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE std_favorites_pages_users ADD CONSTRAINT FK_D91A015036259CF9 FOREIGN KEY (std_pages_id) REFERENCES std_pages (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE std_favorite_pages_users');
$this->addSql('ALTER TABLE std_config CHANGE machine_name machine_name VARCHAR(50) NOT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Unique code used in the programming to identify the config variable\'');
$this->addSql('ALTER TABLE std_languages CHANGE language_code language_code VARCHAR(2) NOT NULL COLLATE utf8mb4_unicode_ci COMMENT \'ISO 639 Language code\'');
$this->addSql('ALTER TABLE std_pages DROP FOREIGN KEY FK_634AB468BF396750');
}
}