summaryrefslogtreecommitdiff
path: root/www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql')
-rw-r--r--www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql33
1 files changed, 33 insertions, 0 deletions
diff --git a/www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql b/www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql
new file mode 100644
index 00000000..d785e984
--- /dev/null
+++ b/www/wiki/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql
@@ -0,0 +1,33 @@
+CREATE TABLE /*_*/site_stats_tmp (
+ -- The single row should contain 1 here.
+ ss_row_id int unsigned NOT NULL PRIMARY KEY,
+
+ -- Total number of edits performed.
+ ss_total_edits bigint unsigned default 0,
+
+ -- An approximate count of pages matching the following criteria:
+ -- * in namespace 0
+ -- * not a redirect
+ -- * contains the text '[['
+ -- See Article::isCountable() in includes/Article.php
+ ss_good_articles bigint unsigned default 0,
+
+ -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
+ ss_total_pages bigint default '-1',
+
+ -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
+ ss_users bigint default '-1',
+
+ -- Number of users that still edit
+ ss_active_users bigint default '-1',
+
+ -- Number of images, equivalent to SELECT COUNT(*) FROM image
+ ss_images int default 0
+) /*$wgDBTableOptions*/;
+
+INSERT INTO /*_*/site_stats_tmp
+ SELECT * FROM /*_*/site_stats;
+
+DROP TABLE /*_*/site_stats;
+
+ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats; \ No newline at end of file