Fix SQLite patch-(page|template)links-fix-pk.sql column order
[lhc/web/wiklou.git] / maintenance / sqlite / archives / patch-site_stats-modify.sql
1 DROP TABLE IF EXISTS /*_*/site_stats_tmp;
2
3 -- Create the temporary table. The following part
4 -- is copied & pasted from the changed tables.sql
5 -- file besides having an other table name.
6 CREATE TABLE /*_*/site_stats_tmp (
7 ss_row_id int unsigned NOT NULL PRIMARY KEY,
8 ss_total_edits bigint unsigned default NULL,
9 ss_good_articles bigint unsigned default NULL,
10 ss_total_pages bigint unsigned default NULL,
11 ss_users bigint unsigned default NULL,
12 ss_active_users bigint unsigned default NULL,
13 ss_images bigint unsigned default NULL
14 ) /*$wgDBTableOptions*/;
15
16 -- Move the data from the old to the new table
17 INSERT OR IGNORE INTO /*_*/site_stats_tmp (
18 ss_row_id,
19 ss_total_edits,
20 ss_good_articles,
21 ss_total_pages,
22 ss_active_users,
23 ss_images
24 ) SELECT
25 ss_row_id,
26 ss_total_edits,
27 ss_good_articles,
28 ss_total_pages,
29 ss_active_users,
30 ss_images
31 FROM /*_*/site_stats;
32
33 DROP TABLE /*_*/site_stats;
34
35 ALTER TABLE /*_*/site_stats_tmp RENAME TO /*_*/site_stats;