Version20150624164100.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V110;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. /**
  7. * Session date changes
  8. */
  9. class Version20150624164100 extends AbstractMigrationChamilo
  10. {
  11. /**
  12. * @param Schema $schema
  13. */
  14. public function up(Schema $schema)
  15. {
  16. $connection = $this->connection;
  17. $sql = "SELECT id FROM extra_field WHERE variable = 'image'";
  18. $result = $connection->executeQuery($sql)->fetchAll();
  19. if (empty($result)) {
  20. $this->addSql("INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at) VALUES (3, 16, 'image', 'Image', 1, 1, NOW())");
  21. }
  22. }
  23. /**
  24. * @param Schema $schema
  25. */
  26. public function down(Schema $schema)
  27. {
  28. $this->addSql("DELETE FROM extra_field
  29. WHERE variable = 'image' AND
  30. extra_field_type = 3 AND
  31. field_type = 16");
  32. }
  33. }