You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.1 KiB
30 lines
1.1 KiB
<?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! |
|
*/ |
|
class Version20180425213959 extends AbstractMigration |
|
{ |
|
public function up(Schema $schema) |
|
{ |
|
// 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 streams CHANGE name name VARCHAR(50) NOT NULL'); |
|
$this->addSql('CREATE UNIQUE INDEX stream_name ON streams (name, user_id)'); |
|
} |
|
|
|
public function down(Schema $schema) |
|
{ |
|
// 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('DROP INDEX stream_name ON streams'); |
|
$this->addSql('ALTER TABLE streams CHANGE name name VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci'); |
|
} |
|
}
|
|
|