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. use Doctrine\DBAL\Types\Type;
  7. /**
  8. * Class Version20160929120000
  9. * Change tables engine to InnoDB
  10. * @package Application\Migrations\Schema\V111
  11. */
  12. class Version20160929120000 extends AbstractMigrationChamilo
  13. {
  14. /**
  15. * @param Schema $schema
  16. * @throws \Doctrine\DBAL\DBALException
  17. * @throws \Doctrine\DBAL\Schema\SchemaException
  18. */
  19. public function up(Schema $schema)
  20. {
  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. }