update.sql 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. INSERT INTO roles (name, role) VALUES('Jury president', 'ROLE_JURY_PRESIDENT');
  2. INSERT INTO roles (name, role) VALUES('Jury member', 'ROLE_JURY_MEMBER');
  3. INSERT INTO roles (name, role) VALUES('Jury substitute', 'ROLE_JURY_SUBSTITUTE');
  4. INSERT INTO roles (name, role) VALUES('Director', 'ROLE_DIRECTOR');
  5. INSERT INTO roles (name, role) VALUES('Exercise stats', 'ROLE_EXERCISE_STATISTICS');
  6. -- Add new configuration setting for action related transaction settings.
  7. INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('log_transactions','exercise_attempt','checkbox','LogTransactions','false','LogTransactionsForExerciseAttempts','LogTransactionsForExerciseAttemptsComment',NULL,'LogTransactionsForExerciseAttemptsText', 1);
  8. INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('transaction_action_map','exercise_attempt','text','TransactionMapping','a:0:{}','TransactionMapForExerciseAttempts','TransactionMapForExerciseAttemptsComment',NULL,'TransactionMapForExerciseAttemptsText', 1);
  9. CREATE TABLE jury (
  10. id int NOT NULL AUTO_INCREMENT,
  11. name varchar(255) DEFAULT NULL,
  12. branch_id int NULL,
  13. opening_date datetime DEFAULT NULL,
  14. closure_date datetime DEFAULT NULL,
  15. opening_user_id int DEFAULT NULL,
  16. closure_user_id int DEFAULT NULL,
  17. exercise_id int NOT NULL,
  18. PRIMARY KEY(id)
  19. );
  20. CREATE TABLE jury_members (
  21. id int NOT NULL AUTO_INCREMENT,
  22. user_id int,
  23. role_id int,
  24. jury_id int,
  25. PRIMARY KEY(id)
  26. );
  27. CREATE TABLE branch_users (
  28. id int NOT NULL AUTO_INCREMENT,
  29. user_id int,
  30. branch_id int,
  31. role_id int,
  32. PRIMARY KEY(id)
  33. );
  34. CREATE TABLE track_attempt_jury(
  35. id int NOT NULL AUTO_INCREMENT,
  36. exe_id INT,
  37. question_id INT,
  38. score float(6,2),
  39. jury_user_id INT,
  40. question_score_name_id INT,
  41. PRIMARY KEY (id)
  42. );
  43. ALTER TABLE track_e_exercices ADD COLUMN jury_score float(6,2);
  44. ALTER TABLE track_e_exercices ADD COLUMN jury_id INT DEFAULT NULL;
  45. -- Rename the transaction import log table and change its structure.
  46. RENAME TABLE branch_sync_log TO branch_transaction_log;
  47. UPDATE settings_current SET selected_value = 'minedu' WHERE variable = 'template';
  48. UPDATE settings_current SET selected_value = 'digedd' WHERE variable = 'stylesheets';
  49. -- the list of questions id that the student will have to go through for this form, split by ","
  50. -- (as in track_e_exercices - this will avoid 60 more queries to the next table once the exam is taking place)
  51. CREATE TABLE c_quiz_distribution (
  52. id int unsigned not null primary key AUTO_INCREMENT,
  53. exercise_id int unsigned not null,
  54. title varchar(255) not null,
  55. data_tracking text not null default '',
  56. active tinyint not null default 1,
  57. author_user_id int unsigned not null,
  58. last_generation_date datetime default null
  59. );
  60. CREATE TABLE c_quiz_distribution_questions (
  61. id int unsigned not null primary key AUTO_INCREMENT,
  62. quiz_distribution_id int unsigned not null, -- the id of the quiz distribution
  63. category_id int unsigned, -- the (global) category ID of the question that has been selected
  64. question_id int unsigned -- the (global) question ID
  65. );
  66. CREATE TABLE c_quiz_distribution_rel_session (
  67. id int unsigned not null primary key AUTO_INCREMENT,
  68. session_id int unsigned not null, -- the session id
  69. c_id int unsigned not null, -- the course id (in case more than one course per session)
  70. exercise_id int unsigned not null, -- the quiz global id
  71. quiz_distribution_id int unsigned not null -- one of the valid distributions for this turn
  72. );
  73. -- store the distribution ID that was assigned to this user (SUPER IMPORTANT TRACKING INFO, DO NOT MISS THIS)
  74. ALTER TABLE track_e_exercices ADD COLUMN quiz_distribution_id int unsigned default null;
  75. -- Fields re-structuring corresponding to plugin generalization.
  76. ALTER TABLE branch_sync
  77. DROP ssl_pub_key,
  78. ADD plugin_envelope varchar(250) null default null,
  79. ADD plugin_send varchar(250) null default null,
  80. ADD plugin_receive varchar(250) null default null,
  81. ADD data TEXT null DEFAULT null COMMENT 'Serialized php array with extra information for the branch. Mainly used by its plugins.';
  82. -- Generalize a little more the transaction log table.
  83. ALTER TABLE branch_transaction_log
  84. ADD log_type int not null after id,
  85. CHANGE transaction_id transaction_id bigint unsigned null default null,
  86. CHANGE import_time log_time datetime not null,
  87. ADD INDEX (log_type);
  88. -- Adds a table to use as queue for received envelopes.
  89. CREATE TABLE received_envelopes (
  90. id int not null AUTO_INCREMENT,
  91. data TEXT not null COMMENT 'The envelope blob.',
  92. status int not null default 1 COMMENT 'See Envelope::RECEIVED_*',
  93. PRIMARY KEY(id)
  94. );
  95. -- Include course and session ids on transactions.
  96. ALTER TABLE branch_transaction
  97. ADD c_id int not null,
  98. ADD session_id int not null;
  99. -- Adds new setting for the local branch id.
  100. INSERT INTO settings_current (variable, type, category, selected_value, title, comment, access_url_changeable) VALUES
  101. ('local_branch_id', 'textfield', 'LogTransactions', 1, 'LogTransactionsDefaultBranch', 'LogTransactionsDefaultBranchComment', 1);
  102. CREATE TABLE branch_rel_session (
  103. id int unsigned not null PRIMARY KEY auto_increment,
  104. branch_id int unsigned not null,
  105. session_id int unsigned not null,
  106. display_order tinyint unsigned not null
  107. );
  108. CREATE TABLE c_quiz_distribution_rel_session_rel_category (
  109. id int unsigned not null primary key AUTO_INCREMENT,
  110. session_id int unsigned, -- the session id
  111. c_id int unsigned not null, -- the course id (in case more than one course per session)
  112. exercise_id int unsigned not null, -- the quiz global id
  113. quiz_distribution_id int unsigned not null, -- one of the valid distributions for this turn
  114. category_id int unsigned not null,
  115. modifier float(6,2) NOT NULL DEFAULT '0.00'
  116. );