2021-10-02 02:32:04 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace ShlinkMigrations;
|
|
|
|
|
2022-01-10 05:05:01 -06:00
|
|
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
2021-10-02 02:32:04 -05:00
|
|
|
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');
|
|
|
|
}
|
2021-10-23 09:02:29 -05:00
|
|
|
|
|
|
|
public function isTransactional(): bool
|
|
|
|
{
|
2022-01-10 05:05:01 -06:00
|
|
|
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
|
2021-10-23 09:02:29 -05:00
|
|
|
}
|
2021-10-02 02:32:04 -05:00
|
|
|
}
|