Version20150511133949.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. * Username changes
  8. */
  9. class Version20150511133949 extends AbstractMigrationChamilo
  10. {
  11. /**
  12. * @param Schema $schema
  13. */
  14. public function up(Schema $schema)
  15. {
  16. $this->addSql('ALTER TABLE user ADD salt VARCHAR(255) NOT NULL');
  17. $this->addSql('ALTER TABLE user ADD username_canonical VARCHAR(100) NOT NULL');
  18. //$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)');
  19. $this->addSql('ALTER TABLE user CHANGE password password VARCHAR(255) NOT NULL');
  20. $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0)");
  21. $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'true', 'Yes')");
  22. $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'false', 'No')");
  23. }
  24. /**
  25. * @param Schema $schema
  26. */
  27. public function down(Schema $schema)
  28. {
  29. $this->addSql('ALTER TABLE user DROP salt');
  30. $this->addSql('DROP INDEX UNIQ_8D93D64992FC23A8 ON user');
  31. $this->addSql('ALTER TABLE user DROP username_canonical');
  32. $this->addSql('ALTER TABLE user CHANGE password password VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci');
  33. $this->addSql('DELETE FROM settings_current WHERE variable = "allow_teachers_to_create_sessions" ');
  34. $this->addSql('DELETE FROM settings_options WHERE variable = "allow_teachers_to_create_sessions" ');
  35. }
  36. }