summaryrefslogtreecommitdiff
path: root/www/wiki/maintenance/sqlite/archives/patch-site_stats-modify.sql
blob: 8d267a62f005c7b506ec802884d1c3331cb35d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
DROP TABLE IF EXISTS /*_*/site_stats_tmp;

-- Create the temporary table. The following part
-- is copied & pasted from the changed tables.sql
-- file besides having an other table name.
CREATE TABLE /*_*/site_stats_tmp (
  ss_row_id int unsigned NOT NULL PRIMARY KEY,
  ss_total_edits bigint unsigned default NULL,
  ss_good_articles bigint unsigned default NULL,
  ss_total_pages bigint unsigned default NULL,
  ss_users bigint unsigned default NULL,
  ss_active_users bigint unsigned default NULL,
  ss_images bigint unsigned default NULL
) /*$wgDBTableOptions*/;

-- Move the data from the old to the new table
INSERT OR IGNORE INTO /*_*/site_stats_tmp (
	ss_row_id,
	ss_total_edits,
	ss_good_articles,
	ss_total_pages,
	ss_active_users,
	ss_images
) SELECT
	ss_row_id,
	ss_total_edits,
	ss_good_articles,
	ss_total_pages,
	ss_active_users,
	ss_images
FROM /*_*/site_stats;

DROP TABLE /*_*/site_stats;

ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;