Version20180809155041.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Application\Migrations;
  3. use MigrationsBundle\Migrations\MigrationsBase;
  4. use Doctrine\DBAL\Schema\Schema;
  5. class Version20180809155041 extends MigrationsBase
  6. {
  7. /**
  8. * @param Schema $schema
  9. */
  10. public function up(Schema $schema)
  11. {
  12. // migrations a borrar
  13. $migrationVersions = [
  14. '20180124153518',
  15. '20180606123455',
  16. ];
  17. foreach ($migrationVersions as $version) {
  18. $this->addSql("DELETE FROM migration_versions WHERE version = {$version};");
  19. }
  20. foreach ($migrationVersions as $version) {
  21. $this->addSql("DELETE FROM migration_versions WHERE version = {$version};");
  22. }
  23. // cargo todos los archivos que esten en src/
  24. // deben tener extensión yml
  25. $directory = __DIR__ . DIRECTORY_SEPARATOR . 'src';
  26. $migrations = scandir($directory);
  27. foreach ($migrations as $migration) {
  28. $this->executeYaml($directory, $migration);
  29. $this->showResult();
  30. }
  31. }
  32. /**
  33. * @param Schema $schema
  34. */
  35. public function down(Schema $schema)
  36. {
  37. }
  38. }