Index: trunk/extensions/Reviews/sql/Reviews.sql |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +-- MySQL version of the database schema for the Reviews extension. |
| 3 | +-- Licence: GNU GPL v3+ |
| 4 | +-- Author: Jeroen De Dauw < jeroendedauw@gmail.com > |
| 5 | + |
| 6 | +-- Reviews |
| 7 | +CREATE TABLE IF NOT EXISTS /*_*/reviews ( |
| 8 | + review_id INT unsigned NOT NULL auto_increment PRIMARY KEY, |
| 9 | + review_page_id INT unsigned NOT NULL, -- Foreign key on page.page_id |
| 10 | + review_user_id INT unsigned NOT NULL, -- Foreign key on user.user_id |
| 11 | + review_text TEXT NOT NULL, -- Review text |
| 12 | + review_post_time varbinary(14) NOT NULL, -- Time when the review was posted |
| 13 | + review_edit_time varbinary(14) NOT NULL, -- Time when the review was editted |
| 14 | + review_state TINYINT unsigned NOT NULL, -- State (new, flagged, reviewed) |
| 15 | + review_rating TINYINT unsigned NOT NULL -- Main rating |
| 16 | +) /*$wgDBTableOptions*/; |
| 17 | + |
| 18 | +CREATE UNIQUE INDEX /*i*/review_page_user ON /*_*/reviews (review_page_id, review_user_id); |
| 19 | +CREATE INDEX /*i*/review_time ON /*_*/reviews (review_time); |
| 20 | +CREATE INDEX /*i*/review_state ON /*_*/reviews (review_state); |
| 21 | +CREATE INDEX /*i*/review_rating ON /*_*/reviews (review_rating); |
| 22 | + |
| 23 | +-- Category specific review ratings |
| 24 | +CREATE TABLE IF NOT EXISTS /*_*/review_ratings ( |
| 25 | + rating_id INT unsigned NOT NULL auto_increment PRIMARY KEY, |
| 26 | + rating_review_id INT unsigned NOT NULL, |
| 27 | + rating_type TINYINT unsigned NOT NULL |
| 28 | +) /*$wgDBTableOptions*/; |
| 29 | + |
| 30 | +CREATE UNIQUE INDEX /*i*/rrating_review_type ON /*_*/review_ratings (rating_review_id, rating_type); |