Version20150505142900.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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;
  7. /**
  8. * Class Version20150505142900
  9. *
  10. * @package Application\Migrations\Schema\V110
  11. */
  12. class Version20150505142900 extends AbstractMigrationChamilo
  13. {
  14. /**
  15. * @param Schema $schema
  16. *
  17. * @throws \Doctrine\DBAL\Schema\SchemaException
  18. */
  19. public function up(Schema $schema)
  20. {
  21. // Create table for video chat
  22. $chatVideoTable = $schema->createTable('chat_video');
  23. $chatVideoTable->addColumn(
  24. 'id',
  25. Type::INTEGER,
  26. ['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
  27. );
  28. $chatVideoTable->addColumn(
  29. 'from_user',
  30. Type::INTEGER,
  31. ['unsigned' => true, 'notnull' => true]
  32. );
  33. $chatVideoTable->addColumn(
  34. 'to_user',
  35. Type::INTEGER,
  36. ['unsigned' => true, 'notnull' => true]
  37. );
  38. $chatVideoTable->addColumn(
  39. 'room_name',
  40. Type::STRING,
  41. ['length' => 255, 'notnull' => true]
  42. );
  43. $chatVideoTable->addColumn(
  44. 'datetime',
  45. Type::DATETIME,
  46. ['notnull' => true]
  47. );
  48. $chatVideoTable->setPrimaryKey(['id']);
  49. $chatVideoTable->addIndex(['from_user'], 'idx_chat_video_from_user');
  50. $chatVideoTable->addIndex(['to_user'], 'idx_chat_video_to_user');
  51. $chatVideoTable->addIndex(['from_user', 'to_user'], 'idx_chat_video_users');
  52. $chatVideoTable->addIndex(['room_name'], 'idx_chat_video_room_name');
  53. }
  54. /**
  55. * We don't allow downgrades yet
  56. * @param Schema $schema
  57. */
  58. public function down(Schema $schema)
  59. {
  60. $schema->dropTable('chat_video');
  61. }
  62. }