Version20160929120000.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V111;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Class Version20160929120000
  8. * Change tables engine to InnoDB
  9. * @package Application\Migrations\Schema\V111
  10. */
  11. class Version20160929120000 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. * @throws \Doctrine\DBAL\DBALException
  16. * @throws \Doctrine\DBAL\Schema\SchemaException
  17. */
  18. public function up(Schema $schema)
  19. {
  20. error_log('Version20160929120000');
  21. $this->addSql("ALTER TABLE c_tool ADD INDEX idx_ctool_name (name(20))");
  22. }
  23. /**
  24. * @param Schema $schema
  25. * @throws \Doctrine\DBAL\DBALException
  26. * @throws \Doctrine\DBAL\Schema\SchemaException
  27. */
  28. public function down(Schema $schema)
  29. {
  30. foreach ($this->names as $name) {
  31. if (!$schema->hasTable($name)) {
  32. continue;
  33. }
  34. $this->addSql("ALTER TABLE c_tool DROP INDEX idx_ctool_name");
  35. }
  36. }
  37. }