X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql

diff --git a/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql b/maintenance/sqlite/archives/patch-site_stats-fix-pk.sql
new file mode 100644
index 00000000..d785e984
--- /dev/null
+++ b/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
