Version20160405112100.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Application\Migrations\Schema\V111;
  3. use Application\Migrations\AbstractMigrationChamilo;
  4. use Doctrine\DBAL\Schema\Schema;
  5. class Version20160405112100 extends AbstractMigrationChamilo
  6. {
  7. /**
  8. * @param Schema $schema
  9. */
  10. public function up(Schema $schema)
  11. {
  12. $this->addSql(
  13. 'CREATE TABLE skill_level_profile (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
  14. );
  15. $this->addSql(
  16. 'CREATE TABLE skill_level (id INT AUTO_INCREMENT NOT NULL, profile_id INT NOT NULL, name VARCHAR(255) NOT NULL, position INT, short_name VARCHAR(255), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
  17. );
  18. $this->addSql(
  19. 'ALTER TABLE skill_rel_user ADD acquired_level INT, ADD argumentation TEXT, ADD argumentation_author_id INT, MODIFY course_id INT, MODIFY session_id INT'
  20. );
  21. $this->addSql(
  22. 'CREATE TABLE skill_rel_user_comment (id INT AUTO_INCREMENT NOT NULL, skill_rel_user_id INT NOT NULL, feedback_giver_id INT NOT NULL, feedback_text TEXT, feedback_value INT, feedback_datetime DATETIME, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
  23. );
  24. $this->addSql(
  25. 'ALTER TABLE skill ADD profile_id INT'
  26. );
  27. }
  28. /**
  29. * @param Schema $schema
  30. */
  31. public function down(Schema $schema)
  32. {
  33. $this->addSql(
  34. 'ALTER TABLE skill_rel_user DROP COLUMN acquired_level, DROP COLUMN argumentation, DROP COLUMN argumentation_author_id, MODIFY course_id INT NOT NULL, MODIFY session_id INT NOT NULL'
  35. );
  36. $this->addSql(
  37. 'ALTER TABLE skill DROP COLUMN profile_id'
  38. );
  39. $this->addSql('DROP TABLE skill_level');
  40. $this->addSql('DROP TABLE skill_level_profile');
  41. }
  42. }