Version20181020065148.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. namespace ShlinkMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\DBAL\Schema\SchemaException;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8. * Auto-generated Migration: Please modify to your needs!
  9. */
  10. final class Version20181020065148 extends AbstractMigration
  11. {
  12. private const CAMEL_CASE_COLUMNS = [
  13. 'countryCode',
  14. 'countryName',
  15. 'regionName',
  16. 'cityName',
  17. ];
  18. /**
  19. * @throws SchemaException
  20. */
  21. public function up(Schema $schema): void
  22. {
  23. $visitLocations = $schema->getTable('visit_locations');
  24. foreach (self::CAMEL_CASE_COLUMNS as $name) {
  25. if ($visitLocations->hasColumn($name)) {
  26. $visitLocations->dropColumn($name);
  27. }
  28. }
  29. }
  30. public function down(Schema $schema): void
  31. {
  32. // No down
  33. }
  34. /**
  35. * @fixme Workaround for https://github.com/doctrine/migrations/issues/1104
  36. */
  37. public function isTransactional(): bool
  38. {
  39. return false;
  40. }
  41. }