Version20190824075137.php 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. declare(strict_types=1);
  3. namespace ShlinkMigrations;
  4. use Doctrine\DBAL\Schema\Column;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\DBAL\Schema\SchemaException;
  7. use Doctrine\Migrations\AbstractMigration;
  8. final class Version20190824075137 extends AbstractMigration
  9. {
  10. /**
  11. * @throws SchemaException
  12. */
  13. public function up(Schema $schema): void
  14. {
  15. $this->getRefererColumn($schema)->setLength(1024);
  16. }
  17. /**
  18. * @throws SchemaException
  19. */
  20. public function down(Schema $schema): void
  21. {
  22. $this->getRefererColumn($schema)->setLength(256);
  23. }
  24. /**
  25. * @throws SchemaException
  26. */
  27. private function getRefererColumn(Schema $schema): Column
  28. {
  29. return $schema->getTable('visits')->getColumn('referer');
  30. }
  31. /**
  32. * @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
  33. */
  34. public function isTransactional(): bool
  35. {
  36. return false;
  37. }
  38. }