mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-28 00:38:46 +03:00
39 lines
943 B
PHP
39 lines
943 B
PHP
<?php
|
|
|
|
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) {
|
|
$column->setPlatformOption('collate', 'BINARY');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param Schema $schema
|
|
*/
|
|
public function down(Schema $schema)
|
|
{
|
|
$db = $this->connection->getDatabasePlatform()->getName();
|
|
}
|
|
}
|