<?php declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20180509192256 extends AbstractMigration
{
    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('ALTER TABLE user CHANGE role role VARCHAR(255) DEFAULT \'user\' NOT NULL');
        $this->addSql('ALTER TABLE endpoint ADD channelName VARCHAR(255) NOT NULL, CHANGE stream_id stream_id INT DEFAULT NULL');
    }

    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('ALTER TABLE endpoint DROP channelName, CHANGE stream_id stream_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE user CHANGE role role VARCHAR(255) DEFAULT \'\'user\'\' NOT NULL COLLATE utf8mb4_unicode_ci');
    }
}
