Version20150625155000.php 1.1 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 Version20150625155000 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 = 'captcha_blocked_until_date'";
  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 (1, 1, 'captcha_blocked_until_date', 'Account locked until', 0, 0, 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 = 'captcha_blocked_until_date' AND
  30. extra_field_type = 1 AND
  31. field_type = 1");
  32. }
  33. }