Version20160808154200.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Version20160808154200
  8. * Set ponderation and destination for questions and answers
  9. * @package Application\Migrations\Schema\V111
  10. */
  11. class Version20160808154200 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. */
  16. public function up(Schema $schema)
  17. {
  18. $question = $schema->getTable('c_quiz_question');
  19. $question
  20. ->getColumn('ponderation')
  21. ->setDefault(0);
  22. $answer = $schema->getTable('c_quiz_answer');
  23. $answer
  24. ->getColumn('ponderation')
  25. ->setDefault(0);
  26. $answer
  27. ->getColumn('destination')
  28. ->setNotnull(false)
  29. ->setDefault(null);
  30. }
  31. /**
  32. * @param Schema $schema
  33. */
  34. public function down(Schema $schema)
  35. {
  36. $answer = $schema->getTable('c_quiz_answer');
  37. $answer
  38. ->getColumn('destination')
  39. ->setNotnull(true)
  40. ->setDefault(0);
  41. }
  42. }