Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql |
— | — | @@ -1,154 +0,0 @@ |
2 | | - |
3 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedpages ( |
4 | | - -- Foreign key to page.page_id |
5 | | - fp_page_id integer unsigned NOT NULL PRIMARY KEY, |
6 | | - -- Is the stable version synced? |
7 | | - fp_reviewed bool NOT NULL default '0', |
8 | | - -- When (or NULL) the first edit after the stable version was made |
9 | | - fp_pending_since varbinary(14) NULL, |
10 | | - -- Foreign key to flaggedrevs.fr_rev_id |
11 | | - fp_stable integer unsigned NOT NULL, |
12 | | - -- The highest quality of the page's reviewed revisions. |
13 | | - -- Note that this may not be set to display by default though. |
14 | | - fp_quality tinyint(1) default NULL |
15 | | -) /*$wgDBTableOptions*/; |
16 | | - |
17 | | -CREATE INDEX /*i*/fp_reviewed_page ON /*_*/flaggedpages (fp_reviewed,fp_page_id); |
18 | | -CREATE INDEX /*i*/fp_quality_page ON /*_*/flaggedpages (fp_quality,fp_page_id); |
19 | | -CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since); |
20 | | - |
21 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_pending ( |
22 | | - -- Foreign key to page.page_id |
23 | | - fpp_page_id integer unsigned NOT NULL, |
24 | | - -- The quality tier (0=checked, 1=quality, 2=pristine) |
25 | | - fpp_quality tinyint(1) NOT NULL, |
26 | | - -- The last rev ID with this quality |
27 | | - fpp_rev_id integer unsigned NOT NULL, |
28 | | - -- Time of the first edit after the last revision reviewed to this level |
29 | | - fpp_pending_since varbinary(14) NOT NULL, |
30 | | - |
31 | | - PRIMARY KEY (fpp_page_id,fpp_quality) |
32 | | -) /*$wgDBTableOptions*/; |
33 | | - |
34 | | -CREATE INDEX /*i*/fpp_quality_pending ON /*_*/flaggedpage_pending (fpp_quality,fpp_pending_since); |
35 | | - |
36 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs ( |
37 | | - -- Foreign key to page.page_id |
38 | | - fr_page_id integer unsigned NOT NULL, |
39 | | - -- Foreign key to revision.rev_id |
40 | | - fr_rev_id integer unsigned NOT NULL, |
41 | | - -- Foreign key to user.user_id |
42 | | - fr_user integer unsigned NOT NULL, |
43 | | - -- Timestamp of review |
44 | | - fr_timestamp varbinary(14) NOT NULL, |
45 | | - -- Review notes |
46 | | - fr_comment mediumblob NOT NULL, |
47 | | - -- The quality tier (0=checked, 1=quality, 2=pristine) |
48 | | - fr_quality tinyint(1) NOT NULL default 0, |
49 | | - -- Store tag metadata as newline separated, |
50 | | - -- colon separated tag:value pairs |
51 | | - fr_tags mediumblob NOT NULL, |
52 | | - -- Store the text with all transclusions resolved |
53 | | - -- This will trade space for speed |
54 | | - fr_text mediumblob NOT NULL, |
55 | | - -- Comma-separated list of flags: |
56 | | - -- dynamic: no text, templates must be fetched |
57 | | - -- auto: revision patrolled automatically |
58 | | - -- utf8: in UTF-8 |
59 | | - fr_flags tinyblob NOT NULL, |
60 | | - -- Parameters for revisions of Image pages: |
61 | | - -- Name of included image (NULL if n/a) |
62 | | - fr_img_name varchar(255) binary NULL default NULL, |
63 | | - -- Timestamp of file (when uploaded) (NULL if n/a) |
64 | | - fr_img_timestamp varbinary(14) NULL default NULL, |
65 | | - -- Statistically unique SHA-1 key (NULL if n/a) |
66 | | - fr_img_sha1 varbinary(32) NULL default NULL, |
67 | | - |
68 | | - PRIMARY KEY (fr_page_id,fr_rev_id) |
69 | | -) /*$wgDBTableOptions*/; |
70 | | - |
71 | | -CREATE INDEX /*i*/fr_img_sha1 ON /*_*/flaggedrevs (fr_img_sha1); |
72 | | -CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
73 | | - |
74 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedtemplates ( |
75 | | - ft_rev_id integer unsigned NOT NULL, |
76 | | - -- Namespace and title of included page |
77 | | - ft_namespace int NOT NULL default '0', |
78 | | - ft_title varchar(255) binary NOT NULL default '', |
79 | | - -- Revisions ID used when reviewed |
80 | | - ft_tmp_rev_id integer unsigned NULL, |
81 | | - |
82 | | - PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
83 | | -) /*$wgDBTableOptions*/; |
84 | | - |
85 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedimages ( |
86 | | - fi_rev_id integer unsigned NOT NULL, |
87 | | - -- Name of included image |
88 | | - fi_name varchar(255) binary NOT NULL default '', |
89 | | - -- Timestamp of image used when reviewed |
90 | | - fi_img_timestamp varbinary(14) NULL, |
91 | | - -- Statistically unique SHA-1 key |
92 | | - fi_img_sha1 varbinary(32) NOT NULL default '', |
93 | | - |
94 | | - PRIMARY KEY (fi_rev_id,fi_name) |
95 | | -) /*$wgDBTableOptions*/; |
96 | | - |
97 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_config ( |
98 | | - -- Foreign key to page.page_id |
99 | | - fpc_page_id integer unsigned NOT NULL PRIMARY KEY, |
100 | | - -- Integers to represent what to show by default: |
101 | | - -- 0: quality -> stable |
102 | | - -- 1: latest reviewed |
103 | | - -- 2: pristine -> quality -> stable |
104 | | - fpc_select integer NOT NULL, |
105 | | - -- Override the page? |
106 | | - fpc_override bool NOT NULL, |
107 | | - -- The protection level (Sysop, etc) for autoreview/review |
108 | | - fpc_level varbinary(60) NULL, |
109 | | - -- Field for time-limited settings |
110 | | - fpc_expiry varbinary(14) NOT NULL default 'infinity' |
111 | | -) /*$wgDBTableOptions*/; |
112 | | - |
113 | | -CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry); |
114 | | - |
115 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_tracking ( |
116 | | - ftr_from integer unsigned NOT NULL default '0', |
117 | | - ftr_namespace int NOT NULL default '0', |
118 | | - ftr_title varchar(255) binary NOT NULL default '' |
119 | | -) /*$wgDBTableOptions*/; |
120 | | - |
121 | | -CREATE UNIQUE INDEX /*i*/from_namespace_title ON /*_*/flaggedrevs_tracking (ftr_from,ftr_namespace,ftr_title); |
122 | | -CREATE INDEX /*i*/namespace_title_from ON /*_*/flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
123 | | - |
124 | | -CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_promote ( |
125 | | - -- Foreign key to user.user_id |
126 | | - frp_user_id integer unsigned NOT NULL PRIMARY KEY, |
127 | | - frp_user_params mediumblob NOT NULL |
128 | | -) /*$wgDBTableOptions*/; |
129 | | - |
130 | | -CREATE TABLE /*_*/flaggedrevs_stats ( |
131 | | - namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY, |
132 | | - total int unsigned NOT NULL DEFAULT 0, |
133 | | - reviewed int unsigned NOT NULL DEFAULT 0, |
134 | | - synced int unsigned NOT NULL DEFAULT 0 |
135 | | -) /*$wgDBTableOptions*/; |
136 | | - |
137 | | -CREATE TABLE /*_*/flaggedrevs_stats2 ( |
138 | | - stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY, |
139 | | - ave_review_time int unsigned NOT NULL DEFAULT 0, |
140 | | - med_review_time int unsigned NOT NULL DEFAULT 0, |
141 | | - ave_pending_time int unsigned NOT NULL DEFAULT 0 |
142 | | -) /*$wgDBTableOptions*/; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.pg.sql |
— | — | @@ -1,83 +0,0 @@ |
2 | | - |
3 | | -BEGIN; |
4 | | - |
5 | | -CREATE TABLE flaggedpages ( |
6 | | - fp_page_id BIGINT NOT NULL DEFAULT 0, |
7 | | - fp_reviewed INTEGER NOT NULL DEFAULT 0, |
8 | | - fp_pending_since TIMESTAMPTZ NULL, |
9 | | - fp_stable BIGINT NOT NULL DEFAULT 0, |
10 | | - fp_quality INTEGER NULL default NULL, |
11 | | - PRIMARY KEY (fp_page_id) |
12 | | -); |
13 | | -CREATE INDEX fp_reviewed_page ON flaggedpages (fp_reviewed,fp_page_id); |
14 | | -CREATE INDEX fp_quality_page ON flaggedpages (fp_quality,fp_page_id); |
15 | | -CREATE INDEX fp_pending_since ON flaggedpages (fp_pending_since); |
16 | | - |
17 | | -CREATE TABLE flaggedpage_pending ( |
18 | | - fpp_page_id BIGINT NOT NULL, |
19 | | - fpp_quality INTEGER NOT NULL, |
20 | | - fpp_rev_id BIGINT NOT NULL, |
21 | | - fpp_pending_since TIMESTAMPTZ NULL, |
22 | | - PRIMARY KEY (fpp_page_id,fpp_quality) |
23 | | -); |
24 | | -CREATE INDEX fpp_quality_pending ON flaggedpage_pending (fpp_quality,fpp_pending_since); |
25 | | - |
26 | | -CREATE TABLE flaggedrevs ( |
27 | | - fr_page_id BIGINT NOT NULL DEFAULT 0, |
28 | | - fr_rev_id BIGINT NOT NULL DEFAULT 0, |
29 | | - fr_user BIGINT NULL REFERENCES mwuser(user_id) ON DELETE SET NULL, |
30 | | - fr_timestamp TIMESTAMPTZ, |
31 | | - fr_comment TEXT NOT NULL DEFAULT '', |
32 | | - fr_quality INTEGER NOT NULL DEFAULT 0, |
33 | | - fr_tags TEXT NOT NULL DEFAULT '', |
34 | | - fr_text TEXT NOT NULL DEFAULT '', |
35 | | - fr_flags TEXT NOT NULL, |
36 | | - fr_img_name TEXT NULL DEFAULT NULL, |
37 | | - fr_img_timestamp TIMESTAMPTZ NULL DEFAULT NULL, |
38 | | - fr_img_sha1 TEXT NULL DEFAULT NULL, |
39 | | - PRIMARY KEY (fr_page_id,fr_rev_id) |
40 | | -); |
41 | | -CREATE INDEX page_qal_rev ON flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
42 | | -CREATE INDEX fr_img_sha1 ON flaggedrevs (fr_img_sha1); |
43 | | - |
44 | | -CREATE TABLE flaggedtemplates ( |
45 | | - ft_rev_id BIGINT NOT NULL DEFAULT 0 , |
46 | | - ft_namespace SMALLINT NOT NULL DEFAULT 0, |
47 | | - ft_title TEXT NOT NULL DEFAULT '', |
48 | | - ft_tmp_rev_id BIGINT NOT NULL DEFAULT 0, |
49 | | - PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
50 | | -); |
51 | | - |
52 | | -CREATE TABLE flaggedimages ( |
53 | | - fi_rev_id BIGINT NOT NULL DEFAULT 0, |
54 | | - fi_name TEXT NOT NULL DEFAULT '', |
55 | | - fi_img_timestamp TIMESTAMPTZ NULL DEFAULT NULL, |
56 | | - fi_img_sha1 CHAR(64) NOT NULL DEFAULT '', |
57 | | - PRIMARY KEY (fi_rev_id,fi_name) |
58 | | -); |
59 | | - |
60 | | -CREATE TABLE flaggedpage_config ( |
61 | | - fpc_page_id BIGINT NOT NULL PRIMARY KEY DEFAULT 0, |
62 | | - fpc_select INTEGER NOT NULL, |
63 | | - fpc_override INTEGER NOT NULL, |
64 | | - fpc_level TEXT NULL, |
65 | | - fpc_expiry TIMESTAMPTZ NULL |
66 | | -); |
67 | | -CREATE INDEX fpc_expiry ON flaggedpage_config (fpc_expiry); |
68 | | - |
69 | | -CREATE TABLE flaggedrevs_tracking ( |
70 | | - ftr_from BIGINT NOT NULL DEFAULT 0, |
71 | | - ftr_namespace SMALLINT NOT NULL DEFAULT 0, |
72 | | - ftr_title TEXT NOT NULL DEFAULT '', |
73 | | - PRIMARY KEY (ftr_from,ftr_namespace,ftr_title) |
74 | | -); |
75 | | -CREATE INDEX namespace_title_from ON flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
76 | | - |
77 | | -CREATE TABLE flaggedrevs_promote ( |
78 | | - frp_user_id BIGINT NOT NULL PRIMARY KEY default 0, |
79 | | - frp_user_params TEXT NOT NULL default '' |
80 | | -); |
81 | | - |
82 | | -COMMIT; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | $wgAutoloadClasses['FlaggedRevsHooks'] = $dir . 'FlaggedRevs.hooks.php'; |
253 | 253 | $wgAutoloadClasses['FlaggedRevsUIHooks'] = $dir . 'presentation/FlaggedRevsUI.hooks.php'; |
254 | 254 | $wgAutoloadClasses['FlaggedRevsApiHooks'] = $dir . 'api/FlaggedRevsApi.hooks.php'; |
255 | | -$wgAutoloadClasses['FlaggedRevsUpdaterHooks'] = $dir . 'updater/FlaggedRevsUpdater.hooks.php'; |
| 255 | +$wgAutoloadClasses['FlaggedRevsUpdaterHooks'] = $dir . 'schema/FlaggedRevsUpdater.hooks.php'; |
256 | 256 | |
257 | 257 | # Data object classes... |
258 | 258 | $wgAutoloadClasses['FRExtraCacheUpdate'] = $dir . 'FRExtraCacheUpdate.php'; |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-expiry-index.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add expiration column index |
| 3 | + |
| 4 | +ALTER TABLE /*$wgDBprefix*/flaggedpage_config |
| 5 | + ADD INDEX (fpc_expiry); |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-expiry-index.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_stats.sql |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +-- Various statistics about the reviewed namespaces |
| 3 | +CREATE TABLE /*_*/flaggedrevs_stats ( |
| 4 | + namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY, |
| 5 | + total int unsigned NOT NULL DEFAULT 0, |
| 6 | + reviewed int unsigned NOT NULL DEFAULT 0, |
| 7 | + synced int unsigned NOT NULL DEFAULT 0 |
| 8 | +) /*$wgDBTableOptions*/; |
| 9 | + |
| 10 | +CREATE TABLE /*_*/flaggedrevs_stats2 ( |
| 11 | + stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY, |
| 12 | + ave_review_time int unsigned NOT NULL DEFAULT 0, |
| 13 | + med_review_time int unsigned NOT NULL DEFAULT 0, |
| 14 | + ave_pending_time int unsigned NOT NULL DEFAULT 0 |
| 15 | +) /*$wgDBTableOptions*/; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_stats.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 16 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-fpc_expiry.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add expiration column |
| 3 | + |
| 4 | +ALTER TABLE /*$wgDBprefix*/flaggedpage_config |
| 5 | + ADD fpc_expiry varbinary(14) NOT NULL default 'infinity'; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-fpc_expiry.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedpages.sql |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +-- Add page metadata for flaggedrevs |
| 3 | +CREATE TABLE /*$wgDBprefix*/flaggedpages ( |
| 4 | + -- Foreign key to page.page_id |
| 5 | + fp_page_id integer unsigned NOT NULL, |
| 6 | + -- Is the page reviewed up to date? |
| 7 | + fp_reviewed bool NOT NULL default '0', |
| 8 | + -- Foreign key to flaggedrevs.fr_rev_id |
| 9 | + fp_stable integer unsigned NOT NULL, |
| 10 | + -- The highest quality of the page's reviewed revisions. |
| 11 | + -- Note that this may not be set to display by default though. |
| 12 | + fp_quality tinyint(1) default NULL, |
| 13 | + |
| 14 | + PRIMARY KEY (fp_page_id), |
| 15 | + INDEX fp_reviewed_page (fp_reviewed,fp_page_id), |
| 16 | + INDEX fp_quality_page (fp_quality,fp_page_id) |
| 17 | +) /*$wgDBTableOptions*/; |
| 18 | + |
| 19 | +-- Migrate old page_ext hacks over |
| 20 | +INSERT INTO /*$wgDBprefix*/flaggedpages (fp_page_id,fp_reviewed,fp_stable,fp_quality) |
| 21 | +SELECT page_id,page_ext_reviewed,page_ext_stable,page_ext_quality FROM /*$wgDBprefix*/page |
| 22 | +WHERE page_ext_stable IS NOT NULL; |
| 23 | + |
| 24 | +-- Leave the old fields for now |
| 25 | +ALTER TABLE /*$wgDBprefix*/page DROP INDEX ext_namespace_reviewed; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedpages.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 26 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedpage_pending.sql |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +-- Add tracking table for edits needing review (for all levels) |
| 3 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_pending ( |
| 4 | + -- Foreign key to page.page_id |
| 5 | + fpp_page_id integer unsigned NOT NULL, |
| 6 | + -- The quality tier (0=stable, 1=quality, 2=pristine) |
| 7 | + fpp_quality tinyint(1) NOT NULL, |
| 8 | + -- The last rev ID with this quality |
| 9 | + fpp_rev_id integer unsigned NOT NULL, |
| 10 | + -- Time (or NULL) of the first edit after the last revision reviewed to this level |
| 11 | + fpp_pending_since varbinary(14) NOT NULL, |
| 12 | + |
| 13 | + PRIMARY KEY (fpp_page_id,fpp_quality), |
| 14 | + INDEX fpp_quality_pending (fpp_quality,fpp_pending_since) |
| 15 | +) /*$wgDBTableOptions*/; |
| 16 | + |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedpage_pending.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-fp_pending_since.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- Add timestamp column of first unreviewed rev for flaggedrevs |
| 3 | +ALTER TABLE /*$wgDBprefix*/flaggedpages |
| 4 | + ADD fp_pending_since varbinary(14) NULL, |
| 5 | + ADD INDEX fp_pending_since (fp_pending_since); |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-fp_pending_since.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_tracking.sql |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +-- Track includes/links only in stable versions |
| 3 | +CREATE TABLE /*$wgDBprefix*/flaggedrevs_tracking ( |
| 4 | + ftr_from integer unsigned NOT NULL default '0', |
| 5 | + ftr_namespace int NOT NULL default '0', |
| 6 | + ftr_title varchar(255) binary NOT NULL default '', |
| 7 | + PRIMARY KEY (ftr_from,ftr_namespace,ftr_title), |
| 8 | + INDEX namespace_title_from (ftr_namespace,ftr_title,ftr_from) |
| 9 | +) /*$wgDBTableOptions*/; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_tracking.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/FlaggedRevs.sql |
— | — | @@ -0,0 +1,154 @@ |
| 2 | +-- (c) Aaron Schulz, 2007-2009, GPL |
| 3 | +-- Table structure for table `Flagged Revisions` |
| 4 | +-- Replace /*_*/ with the proper prefix |
| 5 | +-- Replace /*$wgDBTableOptions*/ with the correct options |
| 6 | + |
| 7 | +-- Add page tracking table for flagged revisions |
| 8 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedpages ( |
| 9 | + -- Foreign key to page.page_id |
| 10 | + fp_page_id integer unsigned NOT NULL PRIMARY KEY, |
| 11 | + -- Is the stable version synced? |
| 12 | + fp_reviewed bool NOT NULL default '0', |
| 13 | + -- When (or NULL) the first edit after the stable version was made |
| 14 | + fp_pending_since varbinary(14) NULL, |
| 15 | + -- Foreign key to flaggedrevs.fr_rev_id |
| 16 | + fp_stable integer unsigned NOT NULL, |
| 17 | + -- The highest quality of the page's reviewed revisions. |
| 18 | + -- Note that this may not be set to display by default though. |
| 19 | + fp_quality tinyint(1) default NULL |
| 20 | +) /*$wgDBTableOptions*/; |
| 21 | + |
| 22 | +CREATE INDEX /*i*/fp_reviewed_page ON /*_*/flaggedpages (fp_reviewed,fp_page_id); |
| 23 | +CREATE INDEX /*i*/fp_quality_page ON /*_*/flaggedpages (fp_quality,fp_page_id); |
| 24 | +CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since); |
| 25 | + |
| 26 | +-- Add tracking table for edits needing review (for all levels) |
| 27 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_pending ( |
| 28 | + -- Foreign key to page.page_id |
| 29 | + fpp_page_id integer unsigned NOT NULL, |
| 30 | + -- The quality tier (0=checked, 1=quality, 2=pristine) |
| 31 | + fpp_quality tinyint(1) NOT NULL, |
| 32 | + -- The last rev ID with this quality |
| 33 | + fpp_rev_id integer unsigned NOT NULL, |
| 34 | + -- Time of the first edit after the last revision reviewed to this level |
| 35 | + fpp_pending_since varbinary(14) NOT NULL, |
| 36 | + |
| 37 | + PRIMARY KEY (fpp_page_id,fpp_quality) |
| 38 | +) /*$wgDBTableOptions*/; |
| 39 | + |
| 40 | +CREATE INDEX /*i*/fpp_quality_pending ON /*_*/flaggedpage_pending (fpp_quality,fpp_pending_since); |
| 41 | + |
| 42 | +-- This stores all of our revision reviews; it is the main table |
| 43 | +-- The template/file version data is stored in the next two tables |
| 44 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs ( |
| 45 | + -- Foreign key to page.page_id |
| 46 | + fr_page_id integer unsigned NOT NULL, |
| 47 | + -- Foreign key to revision.rev_id |
| 48 | + fr_rev_id integer unsigned NOT NULL, |
| 49 | + -- Foreign key to user.user_id |
| 50 | + fr_user integer unsigned NOT NULL, |
| 51 | + -- Timestamp of review |
| 52 | + fr_timestamp varbinary(14) NOT NULL, |
| 53 | + -- Review notes |
| 54 | + fr_comment mediumblob NOT NULL, |
| 55 | + -- The quality tier (0=checked, 1=quality, 2=pristine) |
| 56 | + fr_quality tinyint(1) NOT NULL default 0, |
| 57 | + -- Store tag metadata as newline separated, |
| 58 | + -- colon separated tag:value pairs |
| 59 | + fr_tags mediumblob NOT NULL, |
| 60 | + -- Store the text with all transclusions resolved |
| 61 | + -- This will trade space for speed |
| 62 | + fr_text mediumblob NOT NULL, |
| 63 | + -- Comma-separated list of flags: |
| 64 | + -- dynamic: no text, templates must be fetched |
| 65 | + -- auto: revision patrolled automatically |
| 66 | + -- utf8: in UTF-8 |
| 67 | + fr_flags tinyblob NOT NULL, |
| 68 | + -- Parameters for revisions of Image pages: |
| 69 | + -- Name of included image (NULL if n/a) |
| 70 | + fr_img_name varchar(255) binary NULL default NULL, |
| 71 | + -- Timestamp of file (when uploaded) (NULL if n/a) |
| 72 | + fr_img_timestamp varbinary(14) NULL default NULL, |
| 73 | + -- Statistically unique SHA-1 key (NULL if n/a) |
| 74 | + fr_img_sha1 varbinary(32) NULL default NULL, |
| 75 | + |
| 76 | + PRIMARY KEY (fr_page_id,fr_rev_id) |
| 77 | +) /*$wgDBTableOptions*/; |
| 78 | + |
| 79 | +CREATE INDEX /*i*/fr_img_sha1 ON /*_*/flaggedrevs (fr_img_sha1); |
| 80 | +CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
| 81 | + |
| 82 | +-- This stores all of our transclusion revision pointers |
| 83 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedtemplates ( |
| 84 | + ft_rev_id integer unsigned NOT NULL, |
| 85 | + -- Namespace and title of included page |
| 86 | + ft_namespace int NOT NULL default '0', |
| 87 | + ft_title varchar(255) binary NOT NULL default '', |
| 88 | + -- Revisions ID used when reviewed |
| 89 | + ft_tmp_rev_id integer unsigned NULL, |
| 90 | + |
| 91 | + PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
| 92 | +) /*$wgDBTableOptions*/; |
| 93 | + |
| 94 | +-- This stores all of our image revision pointers |
| 95 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedimages ( |
| 96 | + fi_rev_id integer unsigned NOT NULL, |
| 97 | + -- Name of included image |
| 98 | + fi_name varchar(255) binary NOT NULL default '', |
| 99 | + -- Timestamp of image used when reviewed |
| 100 | + fi_img_timestamp varbinary(14) NULL, |
| 101 | + -- Statistically unique SHA-1 key |
| 102 | + fi_img_sha1 varbinary(32) NOT NULL default '', |
| 103 | + |
| 104 | + PRIMARY KEY (fi_rev_id,fi_name) |
| 105 | +) /*$wgDBTableOptions*/; |
| 106 | + |
| 107 | +-- This stores settings on how to select the stable/default revision |
| 108 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_config ( |
| 109 | + -- Foreign key to page.page_id |
| 110 | + fpc_page_id integer unsigned NOT NULL PRIMARY KEY, |
| 111 | + -- Integers to represent what to show by default: |
| 112 | + -- 0: quality -> stable |
| 113 | + -- 1: latest reviewed |
| 114 | + -- 2: pristine -> quality -> stable |
| 115 | + fpc_select integer NOT NULL, |
| 116 | + -- Override the page? |
| 117 | + fpc_override bool NOT NULL, |
| 118 | + -- The protection level (Sysop, etc) for autoreview/review |
| 119 | + fpc_level varbinary(60) NULL, |
| 120 | + -- Field for time-limited settings |
| 121 | + fpc_expiry varbinary(14) NOT NULL default 'infinity' |
| 122 | +) /*$wgDBTableOptions*/; |
| 123 | + |
| 124 | +CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry); |
| 125 | + |
| 126 | +-- Track includes/links only in stable versions |
| 127 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_tracking ( |
| 128 | + ftr_from integer unsigned NOT NULL default '0', |
| 129 | + ftr_namespace int NOT NULL default '0', |
| 130 | + ftr_title varchar(255) binary NOT NULL default '' |
| 131 | +) /*$wgDBTableOptions*/; |
| 132 | + |
| 133 | +CREATE UNIQUE INDEX /*i*/from_namespace_title ON /*_*/flaggedrevs_tracking (ftr_from,ftr_namespace,ftr_title); |
| 134 | +CREATE INDEX /*i*/namespace_title_from ON /*_*/flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
| 135 | + |
| 136 | +-- This stores user demotions and stats |
| 137 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_promote ( |
| 138 | + -- Foreign key to user.user_id |
| 139 | + frp_user_id integer unsigned NOT NULL PRIMARY KEY, |
| 140 | + frp_user_params mediumblob NOT NULL |
| 141 | +) /*$wgDBTableOptions*/; |
| 142 | + |
| 143 | +CREATE TABLE /*_*/flaggedrevs_stats ( |
| 144 | + namespace int unsigned NOT NULL DEFAULT 0 PRIMARY KEY, |
| 145 | + total int unsigned NOT NULL DEFAULT 0, |
| 146 | + reviewed int unsigned NOT NULL DEFAULT 0, |
| 147 | + synced int unsigned NOT NULL DEFAULT 0 |
| 148 | +) /*$wgDBTableOptions*/; |
| 149 | + |
| 150 | +CREATE TABLE /*_*/flaggedrevs_stats2 ( |
| 151 | + stat_id int unsigned NOT NULL DEFAULT 1 PRIMARY KEY, |
| 152 | + ave_review_time int unsigned NOT NULL DEFAULT 0, |
| 153 | + med_review_time int unsigned NOT NULL DEFAULT 0, |
| 154 | + ave_pending_time int unsigned NOT NULL DEFAULT 0 |
| 155 | +) /*$wgDBTableOptions*/; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/FlaggedRevs.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 156 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-fi_img_timestamp.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- Fix bad fi_img_timestamp definition |
| 3 | +ALTER TABLE /*$wgDBprefix*/flaggedimages |
| 4 | + CHANGE fi_img_timestamp fi_img_timestamp varbinary(14) NULL; |
| 5 | +-- Move bad values over to NULL |
| 6 | +UPDATE /*$wgDBprefix*/flaggedimages |
| 7 | + SET fi_img_timestamp = NULL WHERE LOCATE( '\0', fi_img_timestamp ); |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-fi_img_timestamp.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_promote.sql |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +-- This stores user demotions and stats |
| 3 | +CREATE TABLE /*$wgDBprefix*/flaggedrevs_promote ( |
| 4 | + -- Foreign key to user.user_id |
| 5 | + frp_user_id integer unsigned NOT NULL, |
| 6 | + frp_user_params mediumblob NOT NULL default '', |
| 7 | + |
| 8 | + PRIMARY KEY (frp_user_id) |
| 9 | +) /*$wgDBTableOptions*/; |
| 10 | + |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-flaggedrevs_promote.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-fpc_level.sql |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +-- The protection level (Sysop, autoconfirmed, etc) for autoreview |
| 3 | +ALTER TABLE /*$wgDBprefix*/flaggedpage_config |
| 4 | + ADD fpc_level varbinary(60) NULL; |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-fpc_level.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |
Index: trunk/extensions/FlaggedRevs/schema/mysql/patch-fr_img_name.sql |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +-- Add file metadata for flaggedrevs of image pages |
| 3 | +ALTER TABLE /*$wgDBprefix*/flaggedrevs |
| 4 | + -- Name of included image |
| 5 | + ADD fr_img_name varchar(255) binary NULL default NULL, |
| 6 | + -- Timestamp of file (when uploaded) |
| 7 | + ADD fr_img_timestamp varbinary(14) NULL default NULL, |
| 8 | + -- Statistically unique SHA-1 key |
| 9 | + ADD fr_img_sha1 varbinary(32) NULL default NULL, |
| 10 | + ADD INDEX fr_img_sha1 (fr_img_sha1); |
Property changes on: trunk/extensions/FlaggedRevs/schema/mysql/patch-fr_img_name.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/FlaggedRevs/schema/FlaggedRevsUpdater.hooks.php |
— | — | @@ -0,0 +1,81 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Class containing updater functions for a FlaggedRevs environment |
| 5 | + */ |
| 6 | +class FlaggedRevsUpdaterHooks { |
| 7 | + public static function addSchemaUpdates( DatabaseUpdater $du ) { |
| 8 | + global $wgDBtype; |
| 9 | + if ( $wgDBtype == 'mysql' ) { |
| 10 | + $base = dirname( __FILE__ ) . '/mysql'; |
| 11 | + // Initial install tables (current schema) |
| 12 | + $du->addExtensionUpdate( array( 'addTable', |
| 13 | + 'flaggedrevs', "$base/FlaggedRevs.sql", true ) ); |
| 14 | + // Updates (in order)... |
| 15 | + $du->addExtensionUpdate( array( 'addField', |
| 16 | + 'flaggedpage_config', 'fpc_expiry', "$base/patch-fpc_expiry.sql", true ) ); |
| 17 | + $du->addExtensionUpdate( array( 'addIndex', |
| 18 | + 'flaggedpage_config', 'fpc_expiry', "$base/patch-expiry-index.sql", true ) ); |
| 19 | + $du->addExtensionUpdate( array( 'addTable', |
| 20 | + 'flaggedrevs_promote', "$base/patch-flaggedrevs_promote.sql", true ) ); |
| 21 | + $du->addExtensionUpdate( array( 'addTable', |
| 22 | + 'flaggedpages', "$base/patch-flaggedpages.sql", true ) ); |
| 23 | + $du->addExtensionUpdate( array( 'addField', |
| 24 | + 'flaggedrevs', 'fr_img_name', "$base/patch-fr_img_name.sql", true ) ); |
| 25 | + $du->addExtensionUpdate( array( 'addTable', |
| 26 | + 'flaggedrevs_tracking', "$base/patch-flaggedrevs_tracking.sql", true ) ); |
| 27 | + $du->addExtensionUpdate( array( 'addField', |
| 28 | + 'flaggedpages', 'fp_pending_since', "$base/patch-fp_pending_since.sql", true ) ); |
| 29 | + $du->addExtensionUpdate( array( 'addField', |
| 30 | + 'flaggedpage_config', 'fpc_level', "$base/patch-fpc_level.sql", true ) ); |
| 31 | + $du->addExtensionUpdate( array( 'addTable', |
| 32 | + 'flaggedpage_pending', "$base/patch-flaggedpage_pending.sql", true ) ); |
| 33 | + $du->addExtensionUpdate( array( 'addTable', |
| 34 | + 'flaggedrevs_stats', "$base/patch-flaggedrevs_stats.sql", true ) ); |
| 35 | + $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL', |
| 36 | + "$base/patch-fi_img_timestamp.sql" ) ); |
| 37 | + } elseif ( $wgDBtype == 'postgres' ) { |
| 38 | + $base = dirname( __FILE__ ) . '/postgres'; |
| 39 | + // Initial install tables (current schema) |
| 40 | + $du->addExtensionUpdate( array( 'addTable', |
| 41 | + 'flaggedrevs', "$base/FlaggedRevs.pg.sql", true ) ); |
| 42 | + // Updates (in order)... |
| 43 | + $du->addExtensionUpdate( array( 'addField', |
| 44 | + 'flaggedpage_config', 'fpc_expiry', "TIMESTAMPTZ NULL" ) ); |
| 45 | + $du->addExtensionUpdate( array( 'addIndex', |
| 46 | + 'flaggedpage_config', 'fpc_expiry', "$base/patch-expiry-index.sql", true ) ); |
| 47 | + $du->addExtensionUpdate( array( 'addTable', |
| 48 | + 'flaggedrevs_promote', "$base/patch-flaggedrevs_promote.sql", true ) ); |
| 49 | + $du->addExtensionUpdate( array( 'addTable', |
| 50 | + 'flaggedpages', "$base/patch-flaggedpages.sql", true ) ); |
| 51 | + $du->addExtensionUpdate( array( 'addIndex', |
| 52 | + 'flaggedrevs', 'fr_img_sha1', "$base/patch-fr_img_name.sql", true ) ); |
| 53 | + $du->addExtensionUpdate( array( 'addTable', |
| 54 | + 'flaggedrevs_tracking', "$base/patch-flaggedrevs_tracking.sql", true ) ); |
| 55 | + $du->addExtensionUpdate( array( 'addIndex', |
| 56 | + 'flaggedpages', 'fp_pending_since', "$base/patch-fp_pending_since.sql", true ) ); |
| 57 | + $du->addExtensionUpdate( array( 'addField', |
| 58 | + 'flaggedpage_config', 'fpc_level', "TEXT NULL" ) ); |
| 59 | + $du->addExtensionUpdate( array( 'addTable', |
| 60 | + 'flaggedpage_pending', "$base/patch-flaggedpage_pending.sql", true ) ); |
| 61 | + // @TODO: PG stats table??? |
| 62 | + $du->addExtensionUpdate( array( 'FlaggedRevsUpdaterHooks::doFlaggedImagesTimestampNULL', |
| 63 | + "$base/patch-fi_img_timestamp.sql" ) ); |
| 64 | + } elseif ( $wgDBtype == 'sqlite' ) { |
| 65 | + $base = dirname( __FILE__ ) . '/mysql'; |
| 66 | + $du->addExtensionUpdate( array( 'addTable', |
| 67 | + 'flaggedrevs', "$base/FlaggedRevs.sql", true ) ); |
| 68 | + } |
| 69 | + return true; |
| 70 | + } |
| 71 | + |
| 72 | + public static function doFlaggedImagesTimestampNULL( $du, $patch ) { |
| 73 | + $info = $du->getDB()->fieldInfo( 'flaggedimages', 'fi_img_timestamp' ); |
| 74 | + if ( $info->isNullable() ) { |
| 75 | + $du->output( "...fi_img_timestamp is already nullable.\n" ); |
| 76 | + return; |
| 77 | + } |
| 78 | + $du->output( "Making fi_img_timestamp nullable... " ); |
| 79 | + $du->getDB()->sourceFile( $patch ); |
| 80 | + $du->output( "done.\n" ); |
| 81 | + } |
| 82 | +} |
Property changes on: trunk/extensions/FlaggedRevs/schema/FlaggedRevsUpdater.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 83 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-expiry-index.sql |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +-- Add expiration column index |
| 3 | + |
| 4 | +CREATE INDEX fpc_expiry ON flaggedpage_config (fpc_expiry); |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-expiry-index.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-reader_feedback.sql |
— | — | @@ -0,0 +1,31 @@ |
| 2 | + |
| 3 | +BEGIN; |
| 4 | + |
| 5 | +CREATE TABLE reader_feedback ( |
| 6 | + rfb_rev_id INTEGER NOT NULL DEFAULT 0, |
| 7 | + rfb_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE SET NULL, |
| 8 | + rfb_ip TEXT NOT NULL DEFAULT '', |
| 9 | + PRIMARY KEY (rfb_rev_id,rfb_user,rfb_ip) |
| 10 | +); |
| 11 | + |
| 12 | +CREATE TABLE reader_feedback_history ( |
| 13 | + rfh_page_id INTEGER NOT NULL DEFAULT 0, |
| 14 | + rfh_tag TEXT NOT NULL DEFAULT '', |
| 15 | + rfh_total INTEGER NOT NULL DEFAULT 0, |
| 16 | + rfh_count INTEGER NOT NULL DEFAULT 0, |
| 17 | + -- MW date of the day this average corresponds to |
| 18 | + rfh_date TEXT NOT NULL DEFAULT '', |
| 19 | + PRIMARY KEY (rfh_page_id,rfh_tag,rfh_date) |
| 20 | +); |
| 21 | + |
| 22 | +CREATE TABLE reader_feedback_pages ( |
| 23 | + rfp_page_id INTEGER NOT NULL DEFAULT 0, |
| 24 | + rfp_tag TEXT NOT NULL DEFAULT '', |
| 25 | + rfp_ave_val REAL NOT NULL DEFAULT 0, |
| 26 | + rfp_count INTEGER NOT NULL DEFAULT 0, |
| 27 | + rfp_touched TIMESTAMPTZ NULL, |
| 28 | + PRIMARY KEY (rfp_page_id,rfp_tag) |
| 29 | +); |
| 30 | +CREATE INDEX rfp_tag_val_page ON reader_feedback_pages (rfp_tag,rfp_ave_val,rfp_page_id) |
| 31 | + |
| 32 | +COMMIT; |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-reader_feedback.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 33 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedpages.sql |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +CREATE TABLE flaggedpages ( |
| 5 | + fp_page_id BIGINT NOT NULL DEFAULT 0, |
| 6 | + fp_reviewed INTEGER NOT NULL DEFAULT 0, |
| 7 | + fp_stable BIGINT NOT NULL DEFAULT 0, |
| 8 | + fp_quality INTEGER default NULL, |
| 9 | + PRIMARY KEY (fp_page_id) |
| 10 | +); |
| 11 | +CREATE INDEX fp_reviewed_page ON flaggedpages (fp_reviewed,fp_page_id), |
| 12 | +CREATE INDEX fp_quality_page ON flaggedpages (fp_quality,fp_page_id) |
| 13 | + |
| 14 | +-- Migrate old page_ext hacks over |
| 15 | +INSERT INTO /*$wgDBprefix*/flaggedpages (fp_page_id,fp_reviewed,fp_stable,fp_quality) |
| 16 | +SELECT page_id,page_ext_reviewed,page_ext_stable,page_ext_quality FROM /*$wgDBprefix*/page |
| 17 | +WHERE page_ext_stable IS NOT NULL; |
| 18 | + |
| 19 | +-- Leave the old fields and indexes for now |
| 20 | + |
| 21 | +COMMIT; |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedpages.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 22 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedpage_pending.sql |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +CREATE TABLE flaggedpage_pending ( |
| 5 | + fpp_page_id BIGINT NOT NULL, |
| 6 | + fpp_quality INTEGER NOT NULL, |
| 7 | + fpp_rev_id BIGINT NOT NULL, |
| 8 | + fpp_pending_since TIMESTAMPTZ NULL, |
| 9 | + PRIMARY KEY (fpp_page_id,fpp_quality) |
| 10 | +); |
| 11 | +CREATE INDEX fpp_quality_pending ON flaggedpage_pending (fpp_quality,fpp_pending_since); |
| 12 | + |
| 13 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedpage_pending.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-fp_pending_since.sql |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +ALTER TABLE flaggedpages |
| 5 | + ADD fp_pending_since TIMESTAMPTZ NULL; |
| 6 | + |
| 7 | +CREATE INDEX fp_pending_since ON flaggedpages (fp_pending_since); |
| 8 | + |
| 9 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-fp_pending_since.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_tracking.sql |
— | — | @@ -0,0 +1,11 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +CREATE TABLE flaggedrevs_tracking ( |
| 5 | + ftr_from INTEGER NOT NULL DEFAULT 0, |
| 6 | + ftr_namespace SMALLINT NOT NULL DEFAULT 0, |
| 7 | + ftr_title TEXT NOT NULL DEFAULT '', |
| 8 | + PRIMARY KEY (ftr_from,ftr_namespace,ftr_title) |
| 9 | +); |
| 10 | +CREATE INDEX namespace_title_from ON flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from) |
| 11 | + |
| 12 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_tracking.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 13 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-fi_img_timestamp.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +ALTER TABLE flaggedimages |
| 5 | + CHANGE fi_img_timestamp fi_img_timestamp TIMESTAMPTZ NULL; |
| 6 | + |
| 7 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-fi_img_timestamp.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_promote.sql |
— | — | @@ -0,0 +1,9 @@ |
| 2 | + |
| 3 | +BEGIN; |
| 4 | + |
| 5 | +CREATE TABLE flaggedrevs_promote ( |
| 6 | + frp_user_id INTEGER NOT NULL PRIMARY KEY default 0, |
| 7 | + frp_user_params TEXT NOT NULL default '' |
| 8 | +); |
| 9 | + |
| 10 | +COMMIT; |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-flaggedrevs_promote.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/FlaggedRevs.pg.sql |
— | — | @@ -0,0 +1,83 @@ |
| 2 | +-- (c) Aaron Schulz, 2007 |
| 3 | +-- See FlaggedRevs.sql for details |
| 4 | + |
| 5 | +BEGIN; |
| 6 | + |
| 7 | +CREATE TABLE flaggedpages ( |
| 8 | + fp_page_id BIGINT NOT NULL DEFAULT 0, |
| 9 | + fp_reviewed INTEGER NOT NULL DEFAULT 0, |
| 10 | + fp_pending_since TIMESTAMPTZ NULL, |
| 11 | + fp_stable BIGINT NOT NULL DEFAULT 0, |
| 12 | + fp_quality INTEGER NULL default NULL, |
| 13 | + PRIMARY KEY (fp_page_id) |
| 14 | +); |
| 15 | +CREATE INDEX fp_reviewed_page ON flaggedpages (fp_reviewed,fp_page_id); |
| 16 | +CREATE INDEX fp_quality_page ON flaggedpages (fp_quality,fp_page_id); |
| 17 | +CREATE INDEX fp_pending_since ON flaggedpages (fp_pending_since); |
| 18 | + |
| 19 | +CREATE TABLE flaggedpage_pending ( |
| 20 | + fpp_page_id BIGINT NOT NULL, |
| 21 | + fpp_quality INTEGER NOT NULL, |
| 22 | + fpp_rev_id BIGINT NOT NULL, |
| 23 | + fpp_pending_since TIMESTAMPTZ NULL, |
| 24 | + PRIMARY KEY (fpp_page_id,fpp_quality) |
| 25 | +); |
| 26 | +CREATE INDEX fpp_quality_pending ON flaggedpage_pending (fpp_quality,fpp_pending_since); |
| 27 | + |
| 28 | +CREATE TABLE flaggedrevs ( |
| 29 | + fr_page_id BIGINT NOT NULL DEFAULT 0, |
| 30 | + fr_rev_id BIGINT NOT NULL DEFAULT 0, |
| 31 | + fr_user BIGINT NULL REFERENCES mwuser(user_id) ON DELETE SET NULL, |
| 32 | + fr_timestamp TIMESTAMPTZ, |
| 33 | + fr_comment TEXT NOT NULL DEFAULT '', |
| 34 | + fr_quality INTEGER NOT NULL DEFAULT 0, |
| 35 | + fr_tags TEXT NOT NULL DEFAULT '', |
| 36 | + fr_text TEXT NOT NULL DEFAULT '', |
| 37 | + fr_flags TEXT NOT NULL, |
| 38 | + fr_img_name TEXT NULL DEFAULT NULL, |
| 39 | + fr_img_timestamp TIMESTAMPTZ NULL DEFAULT NULL, |
| 40 | + fr_img_sha1 TEXT NULL DEFAULT NULL, |
| 41 | + PRIMARY KEY (fr_page_id,fr_rev_id) |
| 42 | +); |
| 43 | +CREATE INDEX page_qal_rev ON flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
| 44 | +CREATE INDEX fr_img_sha1 ON flaggedrevs (fr_img_sha1); |
| 45 | + |
| 46 | +CREATE TABLE flaggedtemplates ( |
| 47 | + ft_rev_id BIGINT NOT NULL DEFAULT 0 , |
| 48 | + ft_namespace SMALLINT NOT NULL DEFAULT 0, |
| 49 | + ft_title TEXT NOT NULL DEFAULT '', |
| 50 | + ft_tmp_rev_id BIGINT NOT NULL DEFAULT 0, |
| 51 | + PRIMARY KEY (ft_rev_id,ft_namespace,ft_title) |
| 52 | +); |
| 53 | + |
| 54 | +CREATE TABLE flaggedimages ( |
| 55 | + fi_rev_id BIGINT NOT NULL DEFAULT 0, |
| 56 | + fi_name TEXT NOT NULL DEFAULT '', |
| 57 | + fi_img_timestamp TIMESTAMPTZ NULL DEFAULT NULL, |
| 58 | + fi_img_sha1 CHAR(64) NOT NULL DEFAULT '', |
| 59 | + PRIMARY KEY (fi_rev_id,fi_name) |
| 60 | +); |
| 61 | + |
| 62 | +CREATE TABLE flaggedpage_config ( |
| 63 | + fpc_page_id BIGINT NOT NULL PRIMARY KEY DEFAULT 0, |
| 64 | + fpc_select INTEGER NOT NULL, |
| 65 | + fpc_override INTEGER NOT NULL, |
| 66 | + fpc_level TEXT NULL, |
| 67 | + fpc_expiry TIMESTAMPTZ NULL |
| 68 | +); |
| 69 | +CREATE INDEX fpc_expiry ON flaggedpage_config (fpc_expiry); |
| 70 | + |
| 71 | +CREATE TABLE flaggedrevs_tracking ( |
| 72 | + ftr_from BIGINT NOT NULL DEFAULT 0, |
| 73 | + ftr_namespace SMALLINT NOT NULL DEFAULT 0, |
| 74 | + ftr_title TEXT NOT NULL DEFAULT '', |
| 75 | + PRIMARY KEY (ftr_from,ftr_namespace,ftr_title) |
| 76 | +); |
| 77 | +CREATE INDEX namespace_title_from ON flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
| 78 | + |
| 79 | +CREATE TABLE flaggedrevs_promote ( |
| 80 | + frp_user_id BIGINT NOT NULL PRIMARY KEY default 0, |
| 81 | + frp_user_params TEXT NOT NULL default '' |
| 82 | +); |
| 83 | + |
| 84 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/FlaggedRevs.pg.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 85 | + native |
Index: trunk/extensions/FlaggedRevs/schema/postgres/patch-fr_img_name.sql |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +BEGIN; |
| 3 | + |
| 4 | +ALTER TABLE flaggedrevs |
| 5 | + -- Name of included image |
| 6 | + ADD fr_img_name TEXT NULL default NULL, |
| 7 | + -- Timestamp of file (when uploaded) |
| 8 | + ADD fr_img_timestamp TIMESTAMPTZ NULL default NULL, |
| 9 | + -- Statistically unique SHA-1 key |
| 10 | + ADD fr_img_sha1 TEXT NULL default NULL; |
| 11 | + |
| 12 | +CREATE INDEX fr_img_sha1 ON flaggedrevs (fr_img_sha1); |
| 13 | + |
| 14 | +DROP INDEX fr_namespace_title; |
| 15 | +CREATE INDEX page_qal_rev ON flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
| 16 | + |
| 17 | +COMMIT; |
Property changes on: trunk/extensions/FlaggedRevs/schema/postgres/patch-fr_img_name.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 18 | + native |