Version20150529164400.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. use Doctrine\DBAL\Types\Type as TableColumnType;
  7. /**
  8. * Session date changes
  9. */
  10. class Version20150529164400 extends AbstractMigrationChamilo
  11. {
  12. /**
  13. * @param Schema $schema
  14. */
  15. public function up(Schema $schema)
  16. {
  17. $gradebookScoreLog = $schema->createTable('gradebook_score_log');
  18. $gradebookScoreLog->addColumn(
  19. 'id',
  20. TableColumnType::INTEGER,
  21. ['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
  22. );
  23. $gradebookScoreLog->addColumn(
  24. 'category_id',
  25. TableColumnType::INTEGER,
  26. ['unsigned' => true, 'notnull' => true]
  27. );
  28. $gradebookScoreLog->addColumn(
  29. 'user_id',
  30. TableColumnType::INTEGER,
  31. ['unsigned' => true, 'notnull' => true]
  32. );
  33. $gradebookScoreLog->addColumn(
  34. 'score',
  35. TableColumnType::FLOAT,
  36. ['notnull' => true, 'scale' => 0, 'precision' => 10]
  37. );
  38. $gradebookScoreLog->addColumn(
  39. 'registered_at',
  40. TableColumnType::DATETIME,
  41. ['notnull' => true]
  42. );
  43. $gradebookScoreLog->setPrimaryKey(['id']);
  44. $gradebookScoreLog->addIndex(
  45. ['user_id'],
  46. 'idx_gradebook_score_log_user'
  47. );
  48. $gradebookScoreLog->addIndex(
  49. ['user_id', 'category_id'],
  50. 'idx_gradebook_score_log_user_category'
  51. );
  52. }
  53. /**
  54. * @param Schema $schema
  55. */
  56. public function down(Schema $schema)
  57. {
  58. $schema->dropTable('gradebook_score_log');
  59. }
  60. }