Index: trunk/extensions/ArticleFeedback/RenameTables.sql |
— | — | @@ -1,3 +0,0 @@ |
2 | | -RENAME TABLE /*$wgDBprefix*/article_assessment_ratings TO /*$wgDBprefix*/article_feedback_ratings, |
3 | | - /*$wgDBprefix*/article_assessment TO /*$wgDBprefix*/article_feedback, |
4 | | - /*$wgDBprefix*/article_assessment_pages TO /*$wgDBprefix*/article_feedback_pages; |
\ No newline at end of file |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.sql |
— | — | @@ -1,49 +0,0 @@ |
2 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback_ratings ( |
3 | | - -- Rating Id |
4 | | - aar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
5 | | - -- Text (i18n key) for rating description |
6 | | - aar_rating varchar(255) binary NOT NULL |
7 | | -) /*$wgDBTableOptions*/; |
8 | | - |
9 | | -INSERT INTO /*$wgDBprefix*/article_feedback_ratings (aar_rating) VALUES |
10 | | -('articlefeedback-rating-wellsourced'), ('articlefeedback-rating-neutrality'), |
11 | | -('articlefeedback-rating-completeness'), ('articlefeedback-rating-readability'); |
12 | | - |
13 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback ( |
14 | | - -- Foreign key to page.page_id |
15 | | - aa_page_id integer unsigned NOT NULL, |
16 | | - -- User Id (0 if anon) |
17 | | - aa_user_id integer NOT NULL, |
18 | | - -- Username or IP address |
19 | | - aa_user_text varchar(255) binary NOT NULL, |
20 | | - -- Unique token for anonymous users (to facilitate ratings from multiple users on the same IP) |
21 | | - aa_user_anon_token binary(32) DEFAULT '', |
22 | | - -- Foreign key to revision.rev_id |
23 | | - aa_revision integer unsigned NOT NULL, |
24 | | - -- MW Timestamp |
25 | | - aa_timestamp binary(14) NOT NULL DEFAULT '', |
26 | | - -- Foreign key to article_feedback_ratings.aar_rating |
27 | | - aa_rating_id int unsigned NOT NULL, |
28 | | - -- Value of the rating (0 is "unrated", else 1-5) |
29 | | - aa_rating_value int unsigned NOT NULL, |
30 | | - -- 1 vote per user per revision |
31 | | - PRIMARY KEY (aa_revision, aa_user_text, aa_rating_id, aa_user_anon_token) |
32 | | -) /*$wgDBTableOptions*/; |
33 | | -CREATE INDEX /*i*/aa_user_page_revision ON /*_*/article_feedback (aa_user_id, aa_page_id, aa_revision); |
34 | | - |
35 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback_pages ( |
36 | | - -- Foreign key to page.page_id |
37 | | - aap_page_id integer unsigned NOT NULL, |
38 | | - -- Foreign key to article_feedback_ratings.aar_rating |
39 | | - aap_rating_id integer unsigned NOT NULL, |
40 | | - -- Sum (total) of all the ratings for this article revision |
41 | | - aap_total integer unsigned NOT NULL, |
42 | | - -- Number of ratings |
43 | | - aap_count integer unsigned NOT NULL, |
44 | | - -- One rating row per page |
45 | | - PRIMARY KEY (aap_page_id, aap_rating_id) |
46 | | -) /*$wgDBTableOptions*/; |
\ No newline at end of file |
Index: trunk/extensions/ArticleFeedback/sql/RenameTables.sql |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +RENAME TABLE /*$wgDBprefix*/article_assessment_ratings TO /*$wgDBprefix*/article_feedback_ratings, |
| 3 | + /*$wgDBprefix*/article_assessment TO /*$wgDBprefix*/article_feedback, |
| 4 | + /*$wgDBprefix*/article_assessment_pages TO /*$wgDBprefix*/article_feedback_pages; |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleFeedback/sql/RenameTables.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |
Index: trunk/extensions/ArticleFeedback/sql/ArticleFeedback.sql |
— | — | @@ -0,0 +1,49 @@ |
| 2 | +-- Store mapping of i18n key of "rating" to an ID |
| 3 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback_ratings ( |
| 4 | + -- Rating Id |
| 5 | + aar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 6 | + -- Text (i18n key) for rating description |
| 7 | + aar_rating varchar(255) binary NOT NULL |
| 8 | +) /*$wgDBTableOptions*/; |
| 9 | + |
| 10 | +-- Default article feedback ratings for the pilot |
| 11 | +INSERT INTO /*$wgDBprefix*/article_feedback_ratings (aar_rating) VALUES |
| 12 | +('articlefeedback-rating-wellsourced'), ('articlefeedback-rating-neutrality'), |
| 13 | +('articlefeedback-rating-completeness'), ('articlefeedback-rating-readability'); |
| 14 | + |
| 15 | +-- Store article feedbacks (user rating per revision) |
| 16 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback ( |
| 17 | + -- Foreign key to page.page_id |
| 18 | + aa_page_id integer unsigned NOT NULL, |
| 19 | + -- User Id (0 if anon) |
| 20 | + aa_user_id integer NOT NULL, |
| 21 | + -- Username or IP address |
| 22 | + aa_user_text varchar(255) binary NOT NULL, |
| 23 | + -- Unique token for anonymous users (to facilitate ratings from multiple users on the same IP) |
| 24 | + aa_user_anon_token binary(32) DEFAULT '', |
| 25 | + -- Foreign key to revision.rev_id |
| 26 | + aa_revision integer unsigned NOT NULL, |
| 27 | + -- MW Timestamp |
| 28 | + aa_timestamp binary(14) NOT NULL DEFAULT '', |
| 29 | + -- Foreign key to article_feedback_ratings.aar_rating |
| 30 | + aa_rating_id int unsigned NOT NULL, |
| 31 | + -- Value of the rating (0 is "unrated", else 1-5) |
| 32 | + aa_rating_value int unsigned NOT NULL, |
| 33 | + -- 1 vote per user per revision |
| 34 | + PRIMARY KEY (aa_revision, aa_user_text, aa_rating_id, aa_user_anon_token) |
| 35 | +) /*$wgDBTableOptions*/; |
| 36 | +CREATE INDEX /*i*/aa_user_page_revision ON /*_*/article_feedback (aa_user_id, aa_page_id, aa_revision); |
| 37 | + |
| 38 | +-- Aggregate rating table for a page |
| 39 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_feedback_pages ( |
| 40 | + -- Foreign key to page.page_id |
| 41 | + aap_page_id integer unsigned NOT NULL, |
| 42 | + -- Foreign key to article_feedback_ratings.aar_rating |
| 43 | + aap_rating_id integer unsigned NOT NULL, |
| 44 | + -- Sum (total) of all the ratings for this article revision |
| 45 | + aap_total integer unsigned NOT NULL, |
| 46 | + -- Number of ratings |
| 47 | + aap_count integer unsigned NOT NULL, |
| 48 | + -- One rating row per page |
| 49 | + PRIMARY KEY (aap_page_id, aap_rating_id) |
| 50 | +) /*$wgDBTableOptions*/; |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleFeedback/sql/ArticleFeedback.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 51 | + native |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | global $wgExtNewTables; |
58 | 58 | $wgExtNewTables[] = array( |
59 | 59 | 'article_feedback', |
60 | | - dirname( __FILE__ ) . '/ArticleFeedback.sql' |
| 60 | + dirname( __FILE__ ) . '/sql/ArticleFeedback.sql' |
61 | 61 | ); |
62 | 62 | } else { |
63 | 63 | $dir = dirname( __FILE__ ); |
— | — | @@ -65,10 +65,10 @@ |
66 | 66 | if ( !$db->tableExists( 'article_feedback' ) ) { |
67 | 67 | if ( $db->tableExists( 'article_assessment' ) ) { |
68 | 68 | $updater->addExtensionUpdate( array( 'addTable', 'article_feedback', |
69 | | - $dir . '/RenameTables.sql', true ) ); // Rename tables |
| 69 | + $dir . '/sql/RenameTables.sql', true ) ); // Rename tables |
70 | 70 | } else { |
71 | 71 | $updater->addExtensionUpdate( array( 'addTable', 'article_feedback', |
72 | | - $dir . '/ArticleFeedback.sql', true ) ); // Initial install tables |
| 72 | + $dir . '/sql/ArticleFeedback.sql', true ) ); // Initial install tables |
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |