mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-23 21:27:44 +03:00
32 lines
907 B
PHP
32 lines
907 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ShlinkMigrations;
|
|
|
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
final class Version20211002072605 extends AbstractMigration
|
|
{
|
|
public function up(Schema $schema): void
|
|
{
|
|
$shortUrls = $schema->getTable('short_urls');
|
|
$this->skipIf($shortUrls->hasColumn('forward_query'));
|
|
$shortUrls->addColumn('forward_query', Types::BOOLEAN, ['default' => true]);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$shortUrls = $schema->getTable('short_urls');
|
|
$this->skipIf(! $shortUrls->hasColumn('forward_query'));
|
|
$shortUrls->dropColumn('forward_query');
|
|
}
|
|
|
|
public function isTransactional(): bool
|
|
{
|
|
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
|
|
}
|
|
}
|