Version20150423093100.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. * Class Version20150423093100
  8. *
  9. * @package Application\Migrations\Schema\V110
  10. */
  11. class Version20150423093100 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. *
  16. * @throws \Doctrine\DBAL\Schema\SchemaException
  17. */
  18. public function up(Schema $schema)
  19. {
  20. // Sequence changes
  21. $this->addSql("
  22. CREATE TABLE IF NOT EXISTS sequence_rule (
  23. id int unsigned not null auto_increment,
  24. description TEXT default '',
  25. PRIMARY KEY (id)
  26. )");
  27. $this->addSql("
  28. CREATE TABLE IF NOT EXISTS sequence_condition (
  29. id int unsigned not null auto_increment,
  30. description TEXT default '',
  31. mat_op char(2) not null,
  32. param float not null,
  33. act_true int unsigned,
  34. act_false int unsigned,
  35. PRIMARY KEY (id)
  36. );");
  37. $this->addSql("
  38. CREATE TABLE IF NOT EXISTS sequence_rule_condition (
  39. id int unsigned not null auto_increment,
  40. sequence_rule_id int unsigned not null,
  41. sequence_condition_id int unsigned not null,
  42. PRIMARY KEY (id)
  43. );");
  44. $this->addSql("
  45. CREATE TABLE IF NOT EXISTS sequence_method (
  46. id int unsigned not null auto_increment,
  47. description TEXT default '',
  48. formula TEXT default '',
  49. assign int unsigned not null,
  50. met_type varchar(50) default '',
  51. PRIMARY KEY (id)
  52. );");
  53. $this->addSql("
  54. CREATE TABLE IF NOT EXISTS sequence_rule_method (
  55. id int unsigned not null auto_increment,
  56. sequence_rule_id int unsigned not null,
  57. sequence_method_id int unsigned not null,
  58. method_order int unsigned not null,
  59. PRIMARY KEY (id)
  60. );");
  61. $this->addSql("
  62. CREATE TABLE IF NOT EXISTS sequence_variable (
  63. id int unsigned not null auto_increment,
  64. description TEXT default '',
  65. name varchar(50),
  66. default_val varchar(50) default '',
  67. PRIMARY KEY (id)
  68. );");
  69. $this->addSql("
  70. CREATE TABLE IF NOT EXISTS sequence_formula (
  71. id int unsigned not null auto_increment,
  72. sequence_method_id int unsigned not null,
  73. sequence_variable_id int unsigned not null,
  74. PRIMARY KEY (id)
  75. );");
  76. $this->addSql("
  77. CREATE TABLE IF NOT EXISTS sequence_valid (
  78. id int unsigned not null auto_increment,
  79. sequence_variable_id int unsigned not null,
  80. sequence_condition_id int unsigned not null,
  81. PRIMARY KEY (id)
  82. );");
  83. $this->addSql("
  84. CREATE TABLE IF NOT EXISTS sequence_type_entity (
  85. id int unsigned not null auto_increment,
  86. name varchar(50) not null default '',
  87. description TEXT default '',
  88. ent_table varchar(50) not null,
  89. PRIMARY KEY (id)
  90. );");
  91. $this->addSql("
  92. CREATE TABLE IF NOT EXISTS sequence_row_entity (
  93. id int unsigned not null auto_increment,
  94. sequence_type_entity_id int unsigned not null,
  95. c_id int unsigned not null,
  96. session_id int unsigned not null default 0,
  97. row_id int unsigned not null,
  98. name varchar(200) not null default '',
  99. PRIMARY KEY (id)
  100. );");
  101. $this->addSql("
  102. CREATE TABLE IF NOT EXISTS sequence (
  103. id int unsigned not null auto_increment,
  104. sequence_row_entity_id int unsigned not null,
  105. sequence_row_entity_id_next int unsigned not null,
  106. is_part tinyint unsigned not null default 0,
  107. PRIMARY KEY (id)
  108. );");
  109. $this->addSql("
  110. CREATE TABLE IF NOT EXISTS sequence_value (
  111. id int unsigned not null auto_increment,
  112. user_id int unsigned not null,
  113. sequence_row_entity_id int unsigned not null,
  114. advance float not null default 0.0,
  115. complete_items int not null default 0,
  116. total_items int not null default 1,
  117. success tinyint not null default 0,
  118. success_date datetime not null,
  119. available tinyint not null default 0,
  120. available_start_date datetime not null,
  121. available_end_date datetime not null,
  122. PRIMARY KEY (id)
  123. );");
  124. }
  125. /**
  126. * We don't allow downgrades yet
  127. * @param Schema $schema
  128. */
  129. public function down(Schema $schema)
  130. {
  131. }
  132. }