2021-05-22 08:35:47 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace ShlinkMigrations;
|
|
|
|
|
2022-01-10 14:05:01 +03:00
|
|
|
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
2021-05-22 08:35:47 +03:00
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
|
|
use Doctrine\DBAL\Types\Types;
|
|
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
|
|
|
|
final class Version20210522051601 extends AbstractMigration
|
|
|
|
{
|
|
|
|
public function up(Schema $schema): void
|
|
|
|
{
|
|
|
|
$shortUrls = $schema->getTable('short_urls');
|
|
|
|
$this->skipIf($shortUrls->hasColumn('crawlable'));
|
|
|
|
$shortUrls->addColumn('crawlable', Types::BOOLEAN, ['default' => false]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down(Schema $schema): void
|
|
|
|
{
|
|
|
|
$shortUrls = $schema->getTable('short_urls');
|
|
|
|
$this->skipIf(! $shortUrls->hasColumn('crawlable'));
|
|
|
|
$shortUrls->dropColumn('crawlable');
|
|
|
|
}
|
2021-10-23 17:02:29 +03:00
|
|
|
|
|
|
|
public function isTransactional(): bool
|
|
|
|
{
|
2022-01-10 14:05:01 +03:00
|
|
|
return ! ($this->connection->getDatabasePlatform() instanceof MySQLPlatform);
|
2021-10-23 17:02:29 +03:00
|
|
|
}
|
2021-05-22 08:35:47 +03:00
|
|
|
}
|