2016-08-19 15:51:34 +03:00
|
|
|
<?php
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
2016-08-19 15:51:34 +03:00
|
|
|
|
|
|
|
namespace ShlinkMigrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Migrations\AbstractMigration;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
|
|
*/
|
|
|
|
class Version20160819142757 extends AbstractMigration
|
|
|
|
{
|
|
|
|
const MYSQL = 'mysql';
|
|
|
|
const SQLITE = 'sqlite';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Schema $schema
|
|
|
|
*/
|
|
|
|
public function up(Schema $schema)
|
|
|
|
{
|
|
|
|
$db = $this->connection->getDatabasePlatform()->getName();
|
|
|
|
$table = $schema->getTable('short_urls');
|
|
|
|
$column = $table->getColumn('short_code');
|
|
|
|
|
|
|
|
if ($db === self::MYSQL) {
|
|
|
|
$column->setPlatformOption('collation', 'utf8_bin');
|
|
|
|
} elseif ($db === self::SQLITE) {
|
2016-08-19 16:15:53 +03:00
|
|
|
$column->setPlatformOption('collate', 'BINARY');
|
2016-08-19 15:51:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Schema $schema
|
|
|
|
*/
|
|
|
|
public function down(Schema $schema)
|
|
|
|
{
|
|
|
|
$db = $this->connection->getDatabasePlatform()->getName();
|
|
|
|
}
|
|
|
|
}
|