r111155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111154‎ | r111155 | r111156 >
Date:13:39, 10 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
schema update
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.hooks.php (modified) (history)
  • /trunk/extensions/EducationProgram/sql/EducationProgram.sql (modified) (history)
  • /trunk/extensions/EducationProgram/sql/UpdateUserLinks.sql (added) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/sql/UpdateUserLinks.sql
@@ -0,0 +1,18 @@
 2+-- MySQL for the Education Program extension.
 3+-- Licence: GNU GPL v3+
 4+-- Author: Jeroen De Dauw < jeroendedauw@gmail.com >
 5+
 6+DROP TABLE IF EXISTS /*_*/ep_cas_per_course;
 7+DROP TABLE IF EXISTS /*_*/ep_oas_per_course;
 8+DROP TABLE IF EXISTS /*_*/ep_students_per_course;
 9+
 10+-- Links the students with their courses.
 11+CREATE TABLE IF NOT EXISTS /*_*/ep_users_per_course (
 12+ upc_user_id INT unsigned NOT NULL, -- Foreign key on ep_user.user_id
 13+ upc_course_id INT unsigned NOT NULL, -- Foreign key on ep_courses.course_id
 14+ upc_role TINYINT unsigned NOT NULL -- The role the user has for the course
 15+) /*$wgDBTableOptions*/;
 16+
 17+CREATE UNIQUE INDEX /*i*/ep_users_per_course ON /*_*/ep_users_per_course (upc_user_id, upc_course_id, upc_role);
 18+CREATE INDEX /*i*/ep_upc_course_id ON /*_*/ep_users_per_course (upc_course_id);
 19+CREATE INDEX /*i*/ep_upc_role ON /*_*/ep_users_per_course (upc_role);
\ No newline at end of file
Property changes on: trunk/extensions/EducationProgram/sql/UpdateUserLinks.sql
___________________________________________________________________
Added: svn:eol-style
120 + native
Index: trunk/extensions/EducationProgram/sql/EducationProgram.sql
@@ -104,12 +104,15 @@
105105
106106
107107 -- Links the students with their courses.
108 -CREATE TABLE IF NOT EXISTS /*_*/ep_students_per_course (
109 - spc_student_id INT unsigned NOT NULL, -- Foreign key on ep_students.student_id
110 - spc_course_id INT unsigned NOT NULL -- Foreign key on ep_courses.course_id
 108+CREATE TABLE IF NOT EXISTS /*_*/ep_users_per_course (
 109+ upc_user_id INT unsigned NOT NULL, -- Foreign key on ep_user.user_id
 110+ upc_course_id INT unsigned NOT NULL, -- Foreign key on ep_courses.course_id
 111+ upc_role TINYINT unsigned NOT NULL -- The role the user has for the course
111112 ) /*$wgDBTableOptions*/;
112113
113 -CREATE UNIQUE INDEX /*i*/ep_students_per_course ON /*_*/ep_students_per_course (spc_student_id, spc_course_id);
 114+CREATE UNIQUE INDEX /*i*/ep_users_per_course ON /*_*/ep_users_per_course (upc_user_id, upc_course_id, upc_role);
 115+CREATE INDEX /*i*/ep_upc_course_id ON /*_*/ep_users_per_course (upc_course_id);
 116+CREATE INDEX /*i*/ep_upc_role ON /*_*/ep_users_per_course (upc_role);
114117
115118
116119
@@ -136,17 +139,6 @@
137140
138141
139142
140 -CREATE TABLE IF NOT EXISTS /*_*/ep_cas_per_course (
141 - cpc_user_id INT unsigned NOT NULL, -- Foreign key on user.user_id
142 - cpc_course_id INT unsigned NOT NULL -- Foreign key on ep_course.course_id
143 -) /*$wgDBTableOptions*/;
144 -
145 -CREATE UNIQUE INDEX /*i*/ep_cas_per_course ON /*_*/ep_cas_per_course (cpc_user_id, cpc_course_id);
146 -
147 -
148 -
149143 -- Online ambassadors. In essence this is an extension to the user table.
150144 CREATE TABLE IF NOT EXISTS /*_*/ep_oas (
151145 oa_id INT unsigned NOT NULL auto_increment PRIMARY KEY,
@@ -160,17 +152,6 @@
161153
162154
163155
164 -CREATE TABLE IF NOT EXISTS /*_*/ep_oas_per_course (
165 - opc_user_id INT unsigned NOT NULL, -- Foreign key on user.user_id
166 - opc_course_id INT unsigned NOT NULL -- Foreign key on ep_course.course_id
167 -) /*$wgDBTableOptions*/;
168 -
169 -CREATE UNIQUE INDEX /*i*/ep_oas_per_course ON /*_*/ep_oas_per_course (opc_user_id, opc_course_id);
170 -
171 -
172 -
173156 -- Revision table, holding blobs of various types of objects, such as orgs or students.
174157 -- This is somewhat based on the (core) revision table and is meant to serve
175158 -- as a prototype for a more general system to store this kind of data in a visioned fashion.
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php
@@ -51,6 +51,13 @@
5252 dirname( __FILE__ ) . '/sql/AddRevIdentifier.sql',
5353 true
5454 ) );
 55+
 56+ $updater->addExtensionUpdate( array(
 57+ 'addTable',
 58+ 'ep_users_per_course',
 59+ dirname( __FILE__ ) . '/sql/UpdateUserLinks.sql',
 60+ true
 61+ ) );
5562
5663 return true;
5764 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r111162kill obsolete patches - follow up r111155jeroendedauw15:35, 10 February 2012

Status & tagging log