Version20150608104600.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 Version20150608104600 extends AbstractMigrationChamilo
  11. {
  12. /**
  13. * @param Schema $schema
  14. */
  15. public function up(Schema $schema)
  16. {
  17. $extraFieldRelTag = $schema->createTable('extra_field_rel_tag');
  18. $extraFieldRelTag->addColumn(
  19. 'id',
  20. TableColumnType::INTEGER,
  21. ['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
  22. );
  23. $extraFieldRelTag->addColumn(
  24. 'field_id',
  25. TableColumnType::INTEGER,
  26. ['unsigned' => true, 'notnull' => true]
  27. );
  28. $extraFieldRelTag->addColumn(
  29. 'item_id',
  30. TableColumnType::INTEGER,
  31. ['unsigned' => true, 'notnull' => true]
  32. );
  33. $extraFieldRelTag->addColumn(
  34. 'tag_id',
  35. TableColumnType::INTEGER,
  36. ['unsigned' => true, 'notnull' => true]
  37. );
  38. $extraFieldRelTag->setPrimaryKey(['id']);
  39. $extraFieldRelTag->addIndex(
  40. ['field_id'],
  41. 'idx_frt_field'
  42. );
  43. $extraFieldRelTag->addIndex(
  44. ['item_id'],
  45. 'idx_frt_item'
  46. );
  47. $extraFieldRelTag->addIndex(
  48. ['tag_id'],
  49. 'idx_frt_tag'
  50. );
  51. $extraFieldRelTag->addIndex(
  52. ['field_id', 'item_id', 'tag_id'],
  53. 'idx_frt_field_item_tag'
  54. );
  55. }
  56. /**
  57. * @param Schema $schema
  58. */
  59. public function down(Schema $schema)
  60. {
  61. $schema->dropTable('extra_field_rel_tag');
  62. }
  63. }